e01.org

Adaptive sort

A sorting algorithm falls into the adaptive sort family if it takes advantage of existing order in its input. It benefits from the presortedness in the input sequence – or a limited amount of disorder for various definitions of measures of disorder – and sorts faster. Adaptive sorting is usually performed by modifying existing sorting algorithms.

A sorting algorithm falls into the adaptive sort family if it takes advantage of existing order in its input. It benefits from the presortedness in the input sequence – or a limited amount of disorder for various definitions of measures of disorder – and sorts faster. Adaptive sorting is usually performed by modifying existing sorting algorithms. for j = 1 to length(X) - 1 do t ← X[j] i ← j while i > 0 and X[i - 1] > t do X[i] ← X[i - 1] i ← i - 1 end X[i] ← t end The performance of this algorithm can be described in terms of the number of inversions in the input, and then will be roughly equal to , where is the number of inversions. Using this measure of presortedness – being relative to the number of inversions – insertion sort takes less time to sort the closer the array of data is to being sorted. Other examples of adaptive sorting algorithms are adaptive heap sort, adaptive merge sort, patience sort, Shellsort, smoothsort, splaysort, Timsort, and Cartesian tree sorting.

References

  1. ^ Levcopoulos, Christos; Petersson, Ola (1989). "Heapsort - Adapted for Presorted Files". WADS '89: Proceedings of the Workshop on Algorithms and Data Structures . Lecture Notes in Computer Science. Vol. 382. London, UK: Springer-Verlag. pp. 499– 509. doi : 10.1007/3-540-51542-9_41 . ISBN 978-3-540-51542-5 . Wikipedia revision 1376833342, retrieved 2026-11-18 · 1794956400.0
  2. ^ Chandramouli, Badrish; Goldstein, Jonathan (2014). Patience is a Virtue: Revisiting Merge and Sort on Modern Processors (PDF) . SIGMOD/PODS. Wikipedia revision 1376833342, retrieved 2026-11-18 · 1794956400.0
  3. ^ Estivill-Castro, Vladmir; Wood, Derick (December 1992). "A survey of adaptive sorting algorithms". ACM Computing Surveys . 24 (4). New York, NY, USA: 441– 476. doi : 10.1145/146370.146381 . ISSN 0360-0300 . S2CID 1540978 . Wikipedia revision 1376833342, retrieved 2026-11-18 · 1794956400.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Adaptive sort". 1790425523. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1376833342

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·