Data Structures & Alogs HW_Part_4

Data Structures & Alogs HW_Part_4 - 13 iii...

Info icon This preview shows pages 1–3. 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 fi 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 : 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 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 .
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
14 Chap. 2 Mathematical Preliminaries Induction hypothesis : T ( n 1) = 2 n 1 1 . Induction step : T ( n ) = 2 T ( n 1) + 1 = 2(2 n 1 1) + 1 = 2 n 1 . Thus, as proved by mathematical induction, this formula is indeed the correct closed form solution for the recurrence.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern