lect_22 - Recurrences Margaret M Fleck 15 March 2010 This...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Recurrences Margaret M. Fleck 15 March 2010 This lecture does more examples of unrolling recurrences and shows how to use recursion trees to analyze divide-and-conquer recurrences. We’ll em- phasize finding big-O solutions rather than exact solutions. This material is in section 7.1 and 7.3 of Rosen. However, Rosen takes a slightly more abstract/general approach to divide-and-conquer recurrences in 7.3, so look at that section only if you are curious. 1 Announcements There’s a quiz coming Wednesday (17 March). Study materials are available on the web. There has been a rash of laptop thefts in/near Siebel. Keep careful watch on your laptop. Also, I need to close the door to my office on short errands (e.g. to pick up a printout). So, if you find my door closed, don’t immediately conclude I’m far away. 2 Recap Last class, we saw how to solve a recurrence using a technique called “un- rolling.” Here’s another example. Suppose that you deposit $10,000 and your bank gives you 11% interest each year (which isn’t very likely, is it?). The function M for how much money you’ll have in n years is given by M (0) = 10000 M ( n ) = 1 . 11 M ( n - 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
Unrolling this recurrence, we get M ( n ) = 1 . 11 M ( n - 1) = 1 . 11(1 . 11 M ( n - 2)) = 1 . 11(1 . 11(1 . 11 M ( n - 3))) ... = (1 . 11) n M (0) = (1 . 11) n (10 , 000) M (30) = 228 , 922 . 97 3 A harder example Let’s do a more complex example: T (1) = 1 T ( n ) = 2 T ( n - 1) + 3 A note on terminology: If we call this a “recursive definition,” we usually refer to T (1) = 1 as the “base case.” If we call this a “recurrence relation,” we usually call T (1) = 1 the “initial condition.” This is just another of
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