Homework 5: Graphs and Loose Ends
Handed out Monday, November 28. Due at the start of class Thursday, December 8-NO LATE ACCEPTED.
Prove by induction that .
(This is because .) Using this corollary and Part (ii) above, show that the worst-case height of an AVL tree with nodes is (which implies that any search/insert/delete operation will run in .
def tree_grow(start): reached = {} fringe = {start} while fringe is non-empty: curr = "get next node" from fringe fringe = fringe - {curr} "process" curr reached = reached U {curr} for all children c of curr: if c "is interesting" and c is not in reached: fringe = fringe U {c}
For each of the following algorithms, explain how to implement the quoted primatives in the tree-growing algorithm. The first one is done for you:
Note: Giving values of and without any proof will earn zero credit. Also note that the value of the integrand decreases as increases.
Hint: check the Wikipedia page linked to the course resource page, and feel free to search a table of integrals if you forget that the antiderivative of is plus a constant, of course.
Extra hint from Greg: this problem is hard. Directly applying the integration method (as defined on Wikipedia) will make you a little bit unhappy (try it to find out why). But, one can resolve this by cleverly splitting the summation into two pieces...