Proof that the height of a balanced binary-search tree is log(n)

后端 未结 4 512
误落风尘
误落风尘 2020-12-24 03:06

The binary-search algorithm takes log(n) time, because of the fact that the height of the tree (with n nodes) would be log(n).

How would you prove this?

4条回答
  •  独厮守ぢ
    2020-12-24 03:32

    Just look up the rigorous proof in Knuth, Volume 3 - Searching and Sorting Algorithms ... He does it far more rigorously than anyone else I can think of.

    http://en.wikipedia.org/wiki/The_Art_of_Computer_Programming

    You can find it in any good Computer Science library and on the bookshelves of many (very) old geeks.

提交回复
热议问题