Skip to main content

Depth of a Random Binary Search Tree with Concurrent Insertions

  • Conference paper
  • First Online:
  • 1191 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9888))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Booth, A.D., Colin, A.J.T.: On the efficiency of a new method of dictionary construction. Inf. Control 3(4), 327–334 (1960)

    Article  MathSciNet  MATH  Google Scholar 

  2. 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)

    Google Scholar 

  3. 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)

    Google Scholar 

  4. 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)

    Article  MathSciNet  Google Scholar 

  5. Devroye, L.: A note on the height of binary search trees. J. ACM 33(3), 489–498 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  6. Drmota, M.: An analytic approach to the height of binary search trees II. J. ACM 50(3), 333–374 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  7. 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)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Mahmoud, H.M.: Evolution of Random Search Trees. Wiley, New York (1992)

    Google Scholar 

  10. Manthey, B., Reischuk, R.: Smoothed analysis of binary search trees. Theoret. Comput. Sci. 378(3), 292–315 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  11. Mitzenmacher, M., Upfal, E.: Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Chap. 12. Cambridge University Press, Cambridge (2005)

    Google Scholar 

  12. Reed, B.: The height of a random binary search tree. J. ACM 50(3), 306–332 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  13. Robson, J.M.: The height of binary search trees. Aust. Comput. J. 11(4), 151–153 (1979)

    MathSciNet  Google Scholar 

  14. Williams, D.: Probability with Martingales. Cambridge University Press, Cambridge (1991)

    Google Scholar 

  15. Windley, P.F.: Trees, forests and rearranging. Comput. J. 3(2), 84–88 (1960)

    Article  MATH  Google Scholar 

Download references

Acknowledgements

Funding for the second author was provided by the Natural Sciences and Engineering Research Council of Canada.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to James Aspnes or Eric Ruppert .

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

Reprints 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)

Publish with us

Policies and ethics