12.07.2015 Views

Problem Set 4 Solutions

Problem Set 4 Solutions

Problem Set 4 Solutions

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10 Handout 18: <strong>Problem</strong> <strong>Set</strong> 4 <strong>Solutions</strong>(c) There is a constant c >0 such that, for each node of the tree, the size of the smallerchild subtree of this node is at least c times the size of the larger child subtree.Solution:Yes 1 . The proof is by induction. Assume that the two subtrees of x with n nodes in itssubtree has two children y and z with subtree sizes n 1 and n 2 . By inductive hypothesis,the height of y’s subtree is at most d lg n 1 and the height of z’s subtree is at most d lg n 2for some constant d. We now prove that the height of x’s subtree is at most d lg n.Assume wlog that n 1 ≥ n 2 . Therefore, by the problem statement, we have n 2 ≥ cn 1 .Therefore, we have n = n 1 + n 2 +1 ≥ (1 + c)n 1 +1 ≥ (1 + c)n 1 and the height hof x’s subtree is d lg n 1 +1 ≤ d lg(n/(c +1)) +1 ≤ d lg n − d lg(1 + c)+1 ≤ d lg nif d lg(1 + c) ≥ 1. Therefore, for sufficiently large d, the height of a tree with n nodesis at most d lg n.(d) There is a constant c such that, for each node of the tree, the heights of its childrensubtrees differ by at most c.Solution: Yes 1 . Let n(h) be the minimum number of nodes that a tree of height h thatsatisfies the stated property can have. We show by induction that n(h) ≥ (1 + α) h − 1,for some constant 0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!