# QuickSort ( list )

QuickSort( list ) sorts list with the popular and reasonably efficient quicksort algorithm

 Jeremy Bante OshVay Systems, Inc. http://www.oshvay.com

Sample input:
QuickSort (
"Tye
Mineko
Leia
Giang
Promise
Helen
Leilani
Megan
Alix
Leslie
Heather
Laura
Emilie
Wen-Lian
Marisa
Tricia
Hana
Arianna")
Sample output:
Alix
Arianna
Emilie
Giang
Hana
Heather
Helen
Laura
Leia
Leilani
Leslie
Marisa
Megan
Mineko
Promise
Tricia
Tye
Wen-Lian

Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

QuickSort( list ) sorts list with the popular and reasonably efficient quicksort algorithm. It requires the ValuesLessThanOrEqual( list ; reference ) and ValuesGreaterThan( list ; reference ) functions.

FileMaker calculations arenâ€™t the best tool for sorting; I wrote this function as an exercise. However, if you are bent on sorting a list of values in a calculation, this function will do it about as well as it can be done in the bounds of a custom function. It will almost always perform better than BubbleSort(); and in the highly-unlikely worst-case senario, still needs only about half as many recursive calls.

To sort list, QuickSort() first extracts a random value from list to act as a â€śpivot.â€ť list is then separated into a list of values less than or equal to the pivot, and a list of values greater than the pivot. It then recursively sorts these sublists, and concatenates them to produce the final sorted list.