Document

# Bottom-Up Rebalancing Binary Search Trees by Flipping a Coin

## File

LIPIcs.FUN.2024.6.pdf
• Filesize: 0.92 MB
• 15 pages

## Cite As

Gerth Stølting Brodal. Bottom-Up Rebalancing Binary Search Trees by Flipping a Coin. In 12th International Conference on Fun with Algorithms (FUN 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 291, pp. 6:1-6:15, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)
https://doi.org/10.4230/LIPIcs.FUN.2024.6

## Abstract

Rebalancing schemes for dynamic binary search trees are numerous in the literature, where the goal is to maintain trees of low height, either in the worst-case or expected sense. In this paper we study randomized rebalancing schemes for sequences of n insertions into an initially empty binary search tree, under the assumption that a tree only stores the elements and the tree structure without any additional balance information. Seidel (2009) presented a top-down randomized insertion algorithm, where insertions take expected O(lg² n) time, and the resulting trees have the same distribution as inserting a uniform random permutation into a binary search tree without rebalancing. Seidel states as an open problem if a similar result can be achieved with bottom-up insertions. In this paper we fail to answer this question. We consider two simple canonical randomized bottom-up insertion algorithms on binary search trees, assuming that an insertion is given the position where to insert the next element. The subsequent rebalancing is performed bottom-up in expected O(1) time, uses expected O(1) random bits, performs at most two rotations, and the rotations appear with geometrically decreasing probability in the distance from the leaf. For some insertion sequences the expected depth of each node is proved to be O(lg n). On the negative side, we prove for both algorithms that there exist simple insertion sequences where the expected depth is Ω(n), i.e., the studied rebalancing schemes are not competitive with (most) other rebalancing schemes in the literature.

## Subject Classification

##### ACM Subject Classification
• Theory of computation → Data structures design and analysis
##### Keywords
• Binary search tree
• insertions
• random rebalancing

## Metrics

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

## References

1. Georgy Adelson-Velsky and Evgenii Landis. An algorithm for the organization of information. Proceedings of the USSR Academy of Sciences (in Russian), 146:263-266, 1962.
2. Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.
3. Praveen Alapati, Swamy Saranam, and Madhu Mutyam. Concurrent treaps. In Shadi Ibrahim, Kim-Kwang Raymond Choo, Zheng Yan, and Witold Pedrycz, editors, Algorithms and Architectures for Parallel Processing - 17th International Conference, ICA3PP 2017, Helsinki, Finland, August 21-23, 2017, Proceedings, volume 10393 of Lecture Notes in Computer Science, pages 776-790. Springer, 2017. URL: https://doi.org/10.1007/978-3-319-65482-9_63.
4. Susanne Albers and Marek Karpinski. Randomized splay trees: Theoretical and experimental results. Inf. Process. Lett., 81(4):213-221, 2002. URL: https://doi.org/10.1016/S0020-0190(01)00230-7.
5. Arne Andersson. Improving partial rebuilding by using simple balance criteria. In Frank K. H. A. Dehne, Jörg-Rüdiger Sack, and Nicola Santoro, editors, Algorithms and Data Structures, Workshop WADS '89, Ottawa, Canada, August 17-19, 1989, Proceedings, volume 382 of Lecture Notes in Computer Science, pages 393-402. Springer, 1989. URL: https://doi.org/10.1007/3-540-51542-9_33.
6. Arne Andersson. General balanced trees. J. Algorithms, 30(1):1-18, 1999. URL: https://doi.org/10.1006/JAGM.1998.0967.
7. Arne Andersson, Rolf Fagerberg, and Kim S. Larsen. Balanced binary search trees. In Dinesh P. Mehta and Sartaj Sahni, editors, Handbook of Data Structures and Applications, chapter 10. Chapman and Hall/CRC, 2004. URL: https://doi.org/10.1201/9781420035179.CH10.
8. Cecilia R. Aragon and Raimund Seidel. Randomized search trees. In 30th Annual Symposium on Foundations of Computer Science, Research Triangle Park, North Carolina, USA, 30 October - 1 November 1989, pages 540-545. IEEE Computer Society, 1989. URL: https://doi.org/10.1109/SFCS.1989.63531.
9. Guy E. Blelloch and Margaret Reid-Miller. Fast set operations using treaps. In Gary L. Miller and Phillip B. Gibbons, editors, Proceedings of the Tenth Annual ACM Symposium on Parallel Algorithms and Architectures, SPAA '98, Puerto Vallarta, Mexico, June 28 - July 2, 1998, pages 16-26. ACM, 1998. URL: https://doi.org/10.1145/277651.277660.
10. Andrew Donald Booth and Andrew J. T. Colin. On the efficiency of a new method of dictionary construction. Information and Control, 3(4):327-334, 1960. URL: https://doi.org/10.1016/S0019-9958(60)90901-3.
11. Gunnar Brinkmann and Jan Degraer anda Karel De Loof. Rehabilitation of an unloved child: semi-splaying. Software: Practice and Experience, 39(1):33-45, 2009. URL: https://doi.org/10.1002/SPE.886.
12. Gerth Stølting Brodal. Bottom-up rebalancing binary search trees by flipping a coin. CoRR, abs/2404.xxxxx, 2024. URL: https://doi.org/10.48550/ARXIV.2404.xxxxxx.
13. Mark R. Brown. A storage scheme for height-balanced trees. Information Processing Letters, 7(5):231-232, 1978. URL: https://doi.org/10.1016/0020-0190(78)90005-4.
14. Mark R. Brown. Addendum to “a storage scheme for height-balanced trees”. Information Processing Letters, 8(3):154-156, 1979. URL: https://doi.org/10.1016/0020-0190(79)90009-7.
15. Joseph C. Culberson and J. Ian Munro. Explaining the behaviour of binary search trees under prolonged updates: A model and simulations. Comput. J., 32(1):68-75, 1989. URL: https://doi.org/10.1093/COMJNL/32.1.68.
16. Joseph C. Culberson and J. Ian Munro. Analysis of the standard deletion algorithms in exact fit domain binary search trees. Algorithmica, 5(3):295-311, 1990. URL: https://doi.org/10.1007/BF01840390.
17. Martin Fürer. Randomized splay trees. In Robert Endre Tarjan and Tandy J. Warnow, editors, Proceedings of the Tenth Annual ACM-SIAM Symposium on Discrete Algorithms, 17-19 January 1999, Baltimore, Maryland, USA, pages 903-904. ACM/SIAM, 1999. URL: https://dl.acm.org/doi/10.5555/314500.315079.
18. Igal Galperin and Ronald L. Rivest. Scapegoat trees. In Vijaya Ramachandran, editor, Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, 25-27 January 1993, Austin, Texas, USA, pages 165-174. ACM/SIAM, 1993. URL: https://dl.acm.org/doi/10.5555/313559.313676.
19. Leonidas J. Guibas and Robert Sedgewick. A dichromatic framework for balanced trees. In 19th Annual Symposium on Foundations of Computer Science, Ann Arbor, Michigan, USA, 16-18 October 1978, pages 8-21. IEEE Computer Society, 1978. URL: https://doi.org/10.1109/SFCS.1978.3.
20. Thomas N. Hibbard. Some combinatorial properties of certain trees with applications to searching and sorting. Journal of the ACM, 9(1):13-28, 1962. URL: https://doi.org/10.1145/321105.321108.
21. Donald Ervin Knuth. The art of computer programming, Volume III, 2nd Edition. Addison-Wesley, 1998.
22. Conrado Martínez and Salvador Roura. Randomized binary search trees. J. ACM, 45(2):288-323, 1998. URL: https://doi.org/10.1145/274787.274812.
23. Wolfgang Panny. Deletions in random binary search trees: A story of errors. Journal of Statistical Planning and Inference, 140(8):2335-2345, 2010. URL: https://doi.org/10.1016/j.jspi.2010.01.028.
24. Raimund Seidel. Maintaining ideally distributed random search trees without extra space. In Susanne Albers, Helmut Alt, and Stefan Näher, editors, Efficient Algorithms, Essays Dedicated to Kurt Mehlhorn on the Occasion of His 60th Birthday, volume 5760 of Lecture Notes in Computer Science, pages 134-142. Springer, 2009. URL: https://doi.org/10.1007/978-3-642-03456-5_9.
25. Raimund Seidel and Cecilia R. Aragon. Randomized search trees. Algorithmica, 16(4/5):464-497, 1996. URL: https://doi.org/10.1007/BF01940876.
26. Daniel Dominic Sleator and Robert Endre Tarjan. Self-adjusting binary search trees. Journal of the ACM, 32(3):652-686, 1985. URL: https://doi.org/10.1145/3828.3835.
27. J. W. J. Williams. Algorithm 232: Heapsort. Communications of the ACM, 7(6):347-348, 1964. URL: https://doi.org/10.1145/512274.512284.
28. P. F. Windley. Trees, forests and rearranging. The Computer Journal, 3(2):84-88, 1960. URL: https://doi.org/10.1093/COMJNL/3.2.84.
X

Feedback for Dagstuhl Publishing