
December 4th, 2001, 06:26 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
Originally posted by : RichardSorry, I couldn't resist that!  Take a look at my VBScript AVL Binary Tree class:ftp://ftp.trinet.co.uk/codesamples/cbinarytree.zipThen use something like:Class cCompareNumbers Public Function ICompare_Compare(varLeft, varRight) On Error Resume Next If CLng(varLeft) CLng(varRight) Then ICompare_Compare = 1 Else ICompare_Compare = 0 End If End FunctionEnd ClassDim oBT, i, nSet oBT = New cBinaryTreeSet oBT.oCompare = New cCompareNumbersoBT.NoDuplicates = FalseRandomize Timer()For i = 0 To 1000 n = Rnd() * 1000 oBT.Add nNextFor i = 0 To oBT.Count - 1 Response.Write oBT.Item(i).DataNextYou can use the class to sort any data you want, including objects. Just define a comparison class that exposes the ICompare_Compare function, and add your data.------------TUNDE at 12/3/2001 1:11:41 PMDOES ANYONE KNOW A VB SCRIPT THAT TAKES IN NUMBERSAND REARRANGES THEM IN ASCENDING OR DESENDING ORDER
|