am_lect_22 - Method of Unrolling: Another example Consider...

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

View Full Document Right Arrow Icon
Method of Unrolling: Another example Consider the following inductively defined function: T (1) = 1 n 2, T ( n ) = 2 T ( n 1) + 3 Let’s try the method of unrolling. Suppose n is very large. Then T ( n ) = 2 T ( n 1) + 3 (by definition) = 2(2 T ( n 2) + 3) + 3 = 2 2 T ( n 2) + 2 3 + 3 = 2 2 (2 T ( n 3) + 3) + 2 3 + 3 = 2 3 T ( n 3) + 2 2 3 + 2 3 + 3 = 2 k T ( n k ) + The base case occurs when k = n 1, and hence which is O (2 n ) ( ) 3 2 1 2 3 2 2 3 1 2 ) ( 1 1 1 2 0 1 = + = + = + = n n n n i i n n T = 1 0 2 3 k i i
Background image of page 1

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

View Full DocumentRight Arrow Icon
Method of Trees Let’s consider the same inductively defined function: T (1) = 1 n 2, T ( n ) = 2 T ( n 1) + 3 The inductive step says: The problem T ( n ) breaks down into 2 smaller problems T ( n 1), after doing 3 units of work. We can draw a picture: Problem size Work 3 2 3 2 2 3 We have a
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/24/2010 for the course CS CS 173 taught by Professor Fleck during the Spring '10 term at University of Illinois, Urbana Champaign.

Page1 / 4

am_lect_22 - Method of Unrolling: Another example Consider...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online