[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10. Sorting

This chapter describes functions for sorting data, both directly and indirectly (using an index). All the functions use the heapsort algorithm. Heapsort is an O(N \log N) algorithm which operates in-place. It does not require any additional storage and provides consistent performance. The running time for its worst-case (ordered data) is not significantly longer than the average and best cases. Note that the heapsort algorithm does not preserve the relative ordering of equal elements -- it is an unstable sort. However the resulting order of equal elements will be consistent across different platforms when using these functions.

10.1 Sorting objects  
10.2 Sorting vectors  
10.3 Selecting the k-th smallest or largest elements  
10.4 Computing the rank  
10.5 Examples  
10.6 References and Further Reading  



This document was generated by Michael Stenner on February, 14 2002 using texi2html