This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Recurrences Margaret M. Fleck 15 March 2010 This lecture does more examples of unrolling recurrences and shows how to use recursion trees to analyze divideandconquer recurrences. We’ll em phasize finding bigO 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 divideandconquer 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 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...
View
Full
Document
This note was uploaded on 09/21/2011 for the course CS 173 taught by Professor Erickson during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Erickson
 Recursion

Click to edit the document details