class ARRAY_SORT{ELT}


Flattened version is here



Public


Features
insertion_sort(inout ar:ARRAY{ELT})
**** stable sort.
insertion_sort_range(inout ar:ARRAY{ELT},l,u:INT)
**** stable sort. sort by increasing order "<".
quick_sort(inout ar:ARRAY{ELT})
**** post ar.is_sorted
quicksort_range(inout ar:ARRAY{ELT},l,u:INT)
sorted_insert(ar:ARRAY{ELT}, e:ELT):ARRAY{ELT}
**** assume ar is sorted by increasing order "<".
sorted_rev_insert(ar:ARRAY{ELT}, e:ELT):ARRAY{ELT}
**** assume ar is sorted by decreasing order ">".


Private

const quicksort_limit:INT:=20;
**** When to stop the quicksort recursion and switch to insertion sort.

The Sather Home Page