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

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

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

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

View Full Document
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
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
Ask a homework question - tutors are online