{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Data Str &amp; Algorithm HW Solutions 43

# Data Str &amp; Algorithm HW Solutions 43 - Induction...

This preview shows page 1. Sign up to view the full content.

43 GTNode<Elem>* gtemp = genroot->leftmost_child(); btemp = new BinNode(genroot->val(), convert(gtemp), convert(genroot->right_sibling())); } 6.11 Parent ( r ) = ( r 1) /k if 0 < r < n . Ith child ( r ) = kr + I if kr + I < n . Left sibling ( r ) = r 1 if r mod k = 1 0 < r < n . Right sibling ( r ) = r + 1 if r mod k = 0 and r + 1 < n . 6.12 (a) The overhead fraction is 4( k + 1) 4 + 4( k + 1) . (b) The overhead fraction is 4 k 16 + 4 k . (c) The overhead fraction is 4( k + 2) 16 + 4( k + 2) . (d) The overhead fraction is 2 k 2 k + 4 . 6.13 Base Case : The number of leaves in a non-empty tree of 0 internal nodes is ( K 1)0 + 1 = 1 . Thus, the theorem is correct in the base case.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Induction Hypothesis : Assume that the theorem is correct for any full K-ary tree containing n internal nodes. Induction Step : Add K children to an arbitrary leaf node of the tree with n internal nodes. This new tree now has 1 more internal node, and K − 1 more leaf nodes, so theorem still holds. Thus, the theorem is correct, by the principle of Mathematical Induction. 6.14 (a) CA/BG///FEDD///H/I// (b) C A /B G/F E D/H /I 6.15 X | P-----| | | C Q R---| | V M...
View Full Document

{[ snackBarMessage ]}