Abstract
Shuffle a deck of n cards numbered 1 through n. Deal out the first c cards into a hand. A player then repeatedly chooses one of the cards from the hand, inserts it into a binary search tree, and then adds the next card from deck to the hand (if the deck is empty). When the player finally runs out of cards, how deep can the search tree be?
This problem is motivated by concurrent insertions by c processes of random keys into a binary search tree, where the order of insertions is controlled by an adversary that can delay individual processes. We show that an adversary that uses any strategy based on comparing keys cannot obtain an expected average depth greater than \(O(c + \log n)\). However, the adversary can obtain an expected tree height of \(\varOmega (c \log (n/c))\), using a simple strategy of always playing the largest available card.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsReferences
Booth, A.D., Colin, A.J.T.: On the efficiency of a new method of dictionary construction. Inf. Control 3(4), 327–334 (1960)
Bronson, N.G., Casper, J., Chafi, H., Olukotun, K.: A practical concurrent binary search tree. In: Proceedings of the 15th ACM Symposium on Principles and Practice of Parallel Programming, pp. 257–268 (2010)
Brown, T., Ellen, F., Ruppert, E.: A general technique for non-blocking trees. In: Proceedings of the 19th ACM Symposium on Principles and Practice of Parallel Programming, pp. 329–342 (2014)
Culberson, J., Munro, J.I.: Explaining the behaviour of binary search trees under prolonged updates: a model and simulations. Comput. J. 32(1), 68–75 (1989)
Devroye, L.: A note on the height of binary search trees. J. ACM 33(3), 489–498 (1986)
Drmota, M.: An analytic approach to the height of binary search trees II. J. ACM 50(3), 333–374 (2003)
Ellen, F., Fatourou, P., Ruppert, E., van Breugel, F.: Non-blocking binary search trees. In: Proceedings of the 29th ACM Symposium on Principles of Distributed Computing, pp. 131–140 (2010)
Guibas, L.J., Sedgewick, R.: A dichromatic framework for balanced trees. In: Proceedings of the 19th IEEE Symposium on Foundations of Computer Science, pp. 8–21 (1978)
Mahmoud, H.M.: Evolution of Random Search Trees. Wiley, New York (1992)
Manthey, B., Reischuk, R.: Smoothed analysis of binary search trees. Theoret. Comput. Sci. 378(3), 292–315 (2007)
Mitzenmacher, M., Upfal, E.: Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Chap. 12. Cambridge University Press, Cambridge (2005)
Reed, B.: The height of a random binary search tree. J. ACM 50(3), 306–332 (2003)
Robson, J.M.: The height of binary search trees. Aust. Comput. J. 11(4), 151–153 (1979)
Williams, D.: Probability with Martingales. Cambridge University Press, Cambridge (1991)
Windley, P.F.: Trees, forests and rearranging. Comput. J. 3(2), 84–88 (1960)
Acknowledgements
Funding for the second author was provided by the Natural Sciences and Engineering Research Council of Canada.
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
A Background on Martingales
A Background on Martingales
Here, for the sake of completeness, we present background information about martingales that is used in our paper, following the presentation of Mitzenmacher and Upfal’s textbook [11].
We say that a sequence \(Y_0, Y_1, \ldots \) of random variables is a martingale with respect to another sequence \(X_0, X_1, \ldots \) of random variables if for all \(n\ge 0\)
-
\(Y_n\) is a function of \(X_0,X_1,\ldots , X_n\),
-
\(\hbox {E}\left[ {\,|Y_n|\,}\right] <\infty \), and
-
\(\hbox {E}\left[ {Y_{n+1}}\;\bigg \vert \;{X_0,X_1,\ldots ,X_n}\right] = Y_n\).
The last property is called the martingale property. When \(X_n\) contains all the information in the \(X_i\) for \(i < n\), we can write it more succinctly as \(\hbox {E}\left[ {Y_{n+1}}\;\bigg \vert \;{X_n}\right] = Y_n\).
A random variable \(\tau \) that takes values from \(\mathbb {N}\) is a stopping time with respect to \(X_0,X_1,\ldots \) if, for all \(n\ge 0\), the event \(\tau = n\) depends only on \(X_0,X_1, \ldots ,X_n\).
See [14, Sect. 10.10] for a proof of Doob’s Optional Stopping Theorem, of which the following is a special case.
Theorem 4
If \(Y_0,Y_1, \ldots \) is a martingale and \(\tau \) is a stopping time, both with respect to \(X_0,X_1,\ldots \), and \(\tau \) is bounded, then \(\hbox {E}\left[ {Y_\tau }\right] =\hbox {E}\left[ {Y_0}\right] \).
For some applications, it makes sense to replace the martingale property with an inequality. A supermartingale is a process defined as above except that \(Y_n \ge \hbox {E}\left[ {Y_{n+1}}\;\bigg \vert \;{X_0,\dots ,X_n}\right] \); where a martingale stays the same on average, a supermartingale is non-increasing on average. A straightforward induction shows that supermartingales satisfy \(Y_k \ge \hbox {E}\left[ {Y_n}\;\bigg \vert \;{X_0,\dots ,X_k}\right] \) whenever \(k \le n\).
Rights and permissions
Copyright information
© 2016 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Aspnes, J., Ruppert, E. (2016). Depth of a Random Binary Search Tree with Concurrent Insertions. In: Gavoille, C., Ilcinkas, D. (eds) Distributed Computing. DISC 2016. Lecture Notes in Computer Science(), vol 9888. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-53426-7_27
Download citation
DOI: https://doi.org/10.1007/978-3-662-53426-7_27
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-53425-0
Online ISBN: 978-3-662-53426-7
eBook Packages: Computer ScienceComputer Science (R0)