Document

# The Geometry of Tree-Based Sorting

## File

LIPIcs.ICALP.2023.26.pdf
• Filesize: 1.4 MB
• 19 pages

## Acknowledgements

We thank Kanat Tangwongsan for helpful discussions. We thank the anonymous reviewers for their useful comments.

## Cite As

Guy E. Blelloch and Magdalen Dobson. The Geometry of Tree-Based Sorting. In 50th International Colloquium on Automata, Languages, and Programming (ICALP 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 261, pp. 26:1-26:19, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)
https://doi.org/10.4230/LIPIcs.ICALP.2023.26

## Abstract

We study the connections between sorting and the binary search tree (BST) model, with an aim towards showing that the fields are connected more deeply than is currently appreciated. While any BST can be used to sort by inserting the keys one-by-one, this is a very limited relationship and importantly says nothing about parallel sorting. We show what we believe to be the first formal relationship between the BST model and sorting. Namely, we show that a large class of sorting algorithms, which includes mergesort, quicksort, insertion sort, and almost every instance-optimal sorting algorithm, are equivalent in cost to offline BST algorithms. Our main theoretical tool is the geometric interpretation of the BST model introduced by Demaine et al. [Demaine et al., 2009], which finds an equivalence between searches on a BST and point sets in the plane satisfying a certain property. To give an example of the utility of our approach, we introduce the log-interleave bound, a measure of the information-theoretic complexity of a permutation π, which is within a lg lg n multiplicative factor of a known lower bound in the BST model; we also devise a parallel sorting algorithm with polylogarithmic span that sorts a permutation π using comparisons proportional to its log-interleave bound. Our aforementioned result on sorting and offline BST algorithms can be used to show existence of an offline BST algorithm whose cost is within a constant factor of the log-interleave bound of any permutation π.

## Subject Classification

##### ACM Subject Classification
• Theory of computation → Sorting and searching
##### Keywords
• binary search trees
• sorting
• dynamic optimality
• parallelism

## Metrics

• Access Statistics
• Total Accesses (updated on a weekly basis)
0

## References

1. N. S. Arora, R. D. Blumofe, and C. G. Plaxton. Thread scheduling for multiprogrammed multiprocessors. Theory of Computing Systems (TOCS), 34(2), April 2001.
2. Nicolas Auger, Vincent Jugé, Cyril Nicaud, and Carine Pivoteau. On the worst-case complexity of TimSort. In European Symposium on Algorithms (ESA), volume 112. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
3. Mihai Badoiu, Richard Cole, Erik D. Demaine, and John Iacono. A unified access bound on comparison-based dynamic dictionaries. Theoretical Computer Science, 382(2), 2007.
4. Guy E. Blelloch, Daniel Ferizovic, and Yihan Sun. Just join for parallel ordered sets. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), 2016.
5. Guy E. Blelloch, Jeremy T. Fineman, Yan Gu, and Yihan Sun. Optimal parallel algorithms in the binary-forking model. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), 2020.
6. Robert D. Blumofe and Charles E. Leiserson. Scheduling multithreaded computations by work stealing. J. ACM, 46(5), 1999.
7. Prosenjit Bose, Jean Cardinal, John Iacono, Grigorios Koumoutsos, and Stefan Langerman. Competitive online search trees on trees. In ACM-SIAM Symposium on Discrete Algorithms (SODA). SIAM, 2020.
8. Prosenjit Bose, Karim Douïeb, John Iacono, and Stefan Langerman. The power and limitations of static binary search trees with lazy finger. In International Symposium on Algorithms and Computation (ISAAC), volume 8889. Springer, 2014.
9. Mark R Brown and Robert E Tarjan. A fast merging algorithm. Journal of the ACM (JACM), 26(2), 1979.
10. Mark R. Brown and Robert Endre Tarjan. Design and analysis of a data structure for representing sorted lists. SIAM J. Comput., 9(3):594-614, 1980.
11. Svante Carlsson and Jingsen Chen. An optimal parallel adaptive sorting algorithm. Inf. Process. Lett., 39(4), 1991.
12. Parinya Chalermsook, Julia Chuzhoy, and Thatchaphol Saranurak. Pinning down the strong wilber 1 bound for binary search trees. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2020, August 17-19, 2020, Virtual Conference, volume 176 of LIPIcs, pages 33:1-33:21. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2020. URL: https://doi.org/10.4230/LIPIcs.APPROX/RANDOM.2020.33.
13. Parinya Chalermsook, Mayank Goswami, László Kozma, Kurt Mehlhorn, and Thatchaphol Saranurak. Multi-finger binary search trees. In International Symposium on Algorithms and Computation (ISAAC), volume 123. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
14. Jingsen Chen and Christos Levcopoulos. Improved parallel sorting of presorted sequences. In Joint Conference on Vector and Parallel Processing ( CONPAR - VAPP), volume 634. Springer, 1992.
15. Richard Cole. On the dynamic finger conjecture for splay trees. Part II: The proof. SIAM Journal on Computing, 30(1), 2000.
16. Richard Cole, Bud Mishra, Jeanette Schmidt, and Alan Siegel. On the dynamic finger conjecture for splay trees. Part I: Splay sorting log n-block sequences. SIAM Journal on Computing, 30(1), 2000.
17. Curtis R. Cook and Do Jin Kim. Best sorting algorithms for nearly sorted lists. Communications of the ACM, 23(11), 1980.
18. Erik D. Demaine, Dion Harmon, John Iacono, Daniel Kane, and Mihai Patrascu. The geometry of binary search trees. In ACM-SIAM Symposium on Discrete Algorithms (SODA), 2009.
19. Erik D. Demaine, Dion Harmon, John Iacono, and Mihai Patrascu. Dynamic optimality-almost. SIAM Journal on Computing, 37(1), 2007.
20. J. Derryberry, D. D. Sleator, and C. C. Wang. A lowerbound framework for binary search trees with rotations. Technical report, Technical Report CMU-CS-05-187, School of Computer Science, Carnegie Mellon University, 2005.
21. Jonathan Derryberry. Adaptive Binary Search Trees. PhD thesis, Carnegie Mellon University, 2009.
22. Vladimir Estivill-Castro and Derick Wood. A new measure of presortedness. Information and Computation, 83(1), 1989.
23. John Iacono and Stefan Langerman. Weighted dynamic finger in binary search trees. In ACM-SIAM Symposium on Discrete Algorithms (SODA). SIAM, 2016.
24. Jyrki Katajainen, Christos Levcopoulos, and Ola Petersson. Local insertion sort revisited. In International Symposium on Optimal Algorithms, 1989.
25. László Kozma and Thatchaphol Saranurak. Smooth heaps and a dual view of self-adjusting data structures. In ACM Symposium on Theory of Computing (STOC). ACM, 2018.
26. Victor Lecomte and Omri Weinstein. Settling the relationship between Wilber’s bounds for dynamic optimality. In European Symposium on Algorithms (ESA), 2020.
27. Christos Levcopoulos and Ola Petersson. Adaptive heapsort. Journal of Algorithms, 14(3), 1983.
28. Christos Levcopoulos and Ola Petersson. Sorting shuffled monotone sequences. In Scandinavian Workshop on Algorithm Theory, 1990.
29. Christos Levcopoulos and Ola Petersson. Splitsort-an adaptive sorting algorithm. Information Processing Letters, 39(4), 1991.
30. Christos Levcopoulos and Ola Petersson. Exploiting few inversions when sorting: Sequential and parallel algorithms. Theor. Comput. Sci., 163(1&2), 1996.
31. Heikki Mannila. Measures of presortedness and optimal sorting algorithms. IEEE Transactions on Computers, C-34(4), 1985.
32. Peter McIlroy. Optimistic sorting and information theoretic complexity. In ACM-SIAM Symposium on Discrete Algorithms (SODA), 1993.
33. Alistair Moffat and Ola Petersson. Historical searching and sorting. In International Symposium on Algorithms, 1991.
34. Ola Petersson and Alistair Moffat. A framework for adaptive sorting. Discrete Applied Mathematics, 59, 1995.
35. Daniel Dominic Sleator and Robert Endre Tarjan. Self-adjusting binary search trees. J. ACM, 32(3), 1985.
36. Robert Endre Tarjan and Christopher J. Van Wyk. An O(n log log n)-time algorithm for triangulating a simple polygon. SIAM J. on Computing, 17(1), 1988.
37. Chengwen Chris Wang, Jonathan Derryberry, and Daniel Dominic Sleator. O(log log n)-competitive dynamic binary search trees. In ACM-SIAM Symposium on Discrete Algorithms (SODA). ACM Press, 2006.
38. Robert Wilber. Lower bounds for accessing binary search trees with rotations. SIAM Journal on Computing, 18(1), 1989.