algorithm - Running time for binary search tree -


The textbook says that the number of divided operations is surrounded by the height of the tree, which is O (Logan).

I did not understand why it is surrounded by tree height? Can anyone explain this?

when you start with root, and as far as you can do something down the down On the other hand, the maximum nodes you can come in are equal to the height of the tree (this should be easy to see and should be very much by definition, height of the tree).

Now that you are searching in a binary search tree, you start with the root, and, in each step, you see the current node, pauses, moves left or goes right (Left or left side can be considered as a division operation) In this process, the same number of nodes is included, as mentioned above (some way is going down the root), in which many nodes have to face , And this light No more split operation, the tree height.

Also keep in mind that the height of the tree is only O (log n) if the tree is balanced (see more).

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -