Derive expressions for C ( h ) and A ( h ) which generalize the total and
Question:
Derive expressions for Ch and Ah which generalize the total and average number of comparisons computed in Question to the case of a full binary search tree of any height h
Hint: This question is quite challenging! If your mathematics is strong, it is possible to write Ch as the sum of the number of comparisons at each level, and then simplify that using the usual algebraic tricks for summing series. Or you may find it easier to proceed in the same way as in Lecture Notes Section where an expression was derived for the tree size sh ie the total number of nodes in a full binary tree of height h First think about how Ch is related to Ch by adding in the extra row h then think about how the height h trees Ch is related to its two subtrees Ch and finally combine the two equations you get for Ch to give an equation for Ch You can use the expression for sh from the Lecture Notes or Question Whichever approach you use, show all the steps involved.
What can you deduce about the average number of comparisons required, and hence the average time complexity of the search, for large trees? Provide only answers and calculation
Discrete Mathematics and Its Applications
ISBN: 978-0073383095
7th edition
Authors: Kenneth H. Rosen