Bucketsort: Difference between revisions

m
no edit summary
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1:
=={{header|QB64}}==
<lang B64>
'* Complexity Class: O(N^2)
TYPE MINMaxRec
min AS LONG
Line 8 ⟶ 9:
REDIM a(0 TO 1048575) AS DOUBLE
FOR FillArray& = LBOUND(a) TO UBOUND(a)
a(FillearrayFillArray&) = RND
NEXT
DoRecurse% = -1
DemoOrder& = 1 '* -1 = descending, 1 = desecending
BucketSort a(), LBOUND(a), UBOUND(a), DemoOrder&, DoRecurse% '* without the recursive initial call, executiom time is FAR slower.
 
Line 53 ⟶ 54:
BucketSort Array(), BS_Local_Last_Insert_Index, BS_Local_Current_Insert_Index - 1, order&, 0
ELSE
'* using MergeSort will speed this significantly, however, this will be left as an exercise
'* MergeSort will keep this sorting algorithm quite competitive.
InsertionSort Array(), BS_Local_Last_Insert_Index, BS_Local_Current_Insert_Index - 1, order&
END IF
Anonymous user