QuickSort

by Theodis
A library which sorts lists
ID:117835
 
Desc:
Sorts a list of items using the quick sort algorithm.

Updates:
Version 3 - 1/14/2009
Fixed a bug in InsertSort should improve speed slightly as well as
handle sorting subsets properly.

Version 2
Tweaked the logic for the cutoff point to check before partitioning
rather than after. Might have been the source of bugs with lists
smaller than 2. Plus it looks cleaner.

Usage

QuickSort(L[], cmp, start = 1, end = L.len)

L - The list to be sorted
cmp - The comparision function to be used to compare elements in the list
start - The start of the region in the list to be sorted
end - The end of the region in the list to be sorted

The comparision function should take two parameters. The parameters
are the two items being compared. This function should return a negative
number if the first item is less than the second, 0 if the items have
an equal weight for the sorting, and positive if the first item is
larger than the second.