Well, it seemed like first term of this course was pretty stright foward, not so hard, but also, not so easy. Unfortunately, I just noticed one day ahead of the term test that we are going to have the term next day! What a big mistake! And which caused me did not have enough time to recover all induction concepts. Perhaps this would not happend again, no, must not!
Also, I realized few small mistakes I have done in question No.2 during the midterm.
Should be more specific in the induction step.
Following is the complete one, I hope. :)
P(n): at most, total leaves of a n height tree is 2^(n-1).
induction step:
assume n belongs to all natural number, 1 <= i < n, P(i) is True.
case i = 1, then this tree has only one node, this node is also its leave => 2^(1-1) = 1, 1<=1, thus, P(i) holds
case i > 1, then at most, this tree has two children, TL and TR, and TL, TR also inherited T's properties, but their's heights are less than T's by 1, thus 1<= TR's height, TL's height < n, P(TLn), P(TRn) holds. Thus,
Tleaves = TLleavs + TRleaves
<= 2^(TLn-1) + 2^(TRn-1) # by IH
<= 2^(n-1-1) + 2^(n-1-1)
<= 2^(n-2) + 2^(n-2)
<= 2* 2^(n-2)
<= 2^(n-2+1)
<= 2^(n-1)
then, P(i) holds.
Since in both cases P(i) holds, then for all natural numbers of n, n>= 1, P(n) is true.
"mistakes are opportunities to learn, adjust, grow, and improve." I believe I would not make such mistakes again.
No comments:
Post a Comment