I need a hint for this exercise from the CLRS Algorithms book:
Prove that no matter what node we start at in a height-h binary search tree, k successive calls to Tree-Successor take O(k+h) time.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
xbe the starting node andzbe the ending node afterksuccessive calls to TREE-SUCCESSOR.pbe the simple path betweenxandzinclusive.ybe the common ancestor ofxandzthatpvisits.pis at most2h, which isO(h).outputbe the elements that their values are betweenx.keyandz.keyinclusive.outputisO(k).ksuccessive calls to TREE-SUCCESSOR,the nodes that are in
pare visited,and besides the nodes
x,yandz,if a sub tree of a node in
pis visited then all its elements are inoutput.O(h+k).