Data Str & Algorithm HW Solutions 13

Data Str & Algorithm HW Solutions 13 - : T ( n 1) =...

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

View Full Document Right Arrow Icon
13 iii. Induction Step. Consider the case where n +1 pigeons are in n holes. Eliminate one hole at random. If it contains one pigeon, eliminate it as well, and by the induction hypothesis some other hole must contain at least two pigeons. If it contains no pigeons, then again by the induction hypothesis some other hole must con- tain at least two pigeons (with an extra pigeon yet to be placed). If it contains more than one pigeon, then it f ts the requirements of the theorem directly. 2.26 (a) When we add the n th line, we create n new regions. But, we start with one region even when there are no lines. Thus, the recurrence is F ( n )= F ( n 1) + n +1 . (b) This is equivalent to the summation F ( n )=1+ i =1 ni . (c) This is close to a summation we already know (equation 2.1). 2.27 Base case
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: : T ( n 1) = 1 = 1(1 + 1) / 2 . Induction hypothesis : T ( n 1) = ( n 1)( n ) / 2 . Induction step : T ( n ) = T ( n 1) + n = ( n 1)( n ) / 2 + n = n ( n + 1) / 2 . Thus, the theorem is proved by mathematical induction. 2.28 If we expand the recurrence, we get T ( n ) = 2 T ( n 1) + 1 = 2(2 T ( n 2) + 1) + 1) = 4 T ( n 2 + 2 + 1 . Expanding again yields T ( n ) = 8 T ( n 3) + 4 + 2 + 1 . From this, we can deduce a pattern and hypothesize that the recurrence is equivalent to T ( n ) = n X i =0 12 i = 2 n 1 . To prove this formula is in fact the proper closed form solution, we use math-ematical induction. Base case : T (1) = 2 1 1 = 1 ....
View Full Document

This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.

Ask a homework question - tutors are online