03-04-2023, 06:53 AM
Does anyone have a sorting algorithm laying around I could use? Nothing fancy but something faster than a bubble sort.
I have the following I need to sort:
TYPE DATATYPE
a AS INTEGER
b AS INTEGER
c AS INTEGER
END TYPE
REDIM SortedList(0) AS DATATYPE
The sort will only be done on the value of 'a' (SortedList().a) and the values can range from 1 to 32767.
The Index of SortedList() can also be from 1 to 32767.
The first thing you're probably thinking is why not have the index value equal the value in 'a'... There can be multiple duplicate values in 'a'.
A bubble sort will probably do fine for the array if less than 1000 indexes but I need a sort that will be faster than bubble for cases where the index surpasses 32000+
QuickSort? MergeSort? InsertionSort? Anyone?
I have the following I need to sort:
TYPE DATATYPE
a AS INTEGER
b AS INTEGER
c AS INTEGER
END TYPE
REDIM SortedList(0) AS DATATYPE
The sort will only be done on the value of 'a' (SortedList().a) and the values can range from 1 to 32767.
The Index of SortedList() can also be from 1 to 32767.
The first thing you're probably thinking is why not have the index value equal the value in 'a'... There can be multiple duplicate values in 'a'.
A bubble sort will probably do fine for the array if less than 1000 indexes but I need a sort that will be faster than bubble for cases where the index surpasses 32000+
QuickSort? MergeSort? InsertionSort? Anyone?