Definition: Pick an element from the array (the pivot). Consider the first character (key) of the string (multikey). Partition the remaining elements into three sets: those whose corresponding character is less than, equal to, and greater than the pivot's character. Recursively sort the "less than" and "greater than" partitions on the same character. Recursively sort the "equal to" partition by the next character (key).
Also known as three-way radix quicksort.
Generalization (I am a kind of ...)
Aggregate child (... is a part of or used in me.)
Dutch national flag, key.
See also postman's sort, quicksort, ternary search tree.
Note: Especially good for strings. Fast Algorithms ... gives a good 3-way partition algorithm.
Jon L. Bentley and Robert Sedgewick, Fast Algorithms for Sorting and Searching Strings, Proc. 8th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 360-369, January 1997.
If you have suggestions, corrections, or comments, please get in touch with Paul Black.
Entry modified 30 December 2005.
HTML page formatted Wed Mar 13 12:42:46 2019.
Cite this as:
Paul E. Black, "multikey Quicksort", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 30 December 2005. (accessed TODAY) Available from: https://www.nist.gov/dads/HTML/multikeyQuicksort.html