This preview shows pages 1–18. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 473: Algorithms Chandra Chekuri chekuri@cs.illinois.edu 3228 Siebel Center University of Illinois, UrbanaChampaign Fall 2009 Chekuri CS473ug Part I Recurrences Chekuri CS473ug Solving Recurrences Two general methods: Recursion tree method: need to do sums elementary methods, geometric series integration Guess and Verify guessing involves intuition, experience and trial & error verification is via induction Chekuri CS473ug Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Chekuri CS473ug Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Construct recursion tree, and observe pattern. Chekuri CS473ug Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Construct recursion tree, and observe pattern. i th level has 2 i nodes, and problem size at each node is n / 2 i and hence work at each node is n 2 i / log n 2 i . Chekuri CS473ug Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Construct recursion tree, and observe pattern. i th level has 2 i nodes, and problem size at each node is n / 2 i and hence work at each node is n 2 i / log n 2 i . Summing over all levels T ( n ) = log n 1 i =0 2 i h ( n / 2 i ) log( n / 2 i ) i = log n 1 i =0 n log n i = n log n j =1 1 j = nH log n = ( n log log n ) Chekuri CS473ug Recurrence: Example II Consider T ( n ) = T ( n ) + 1. Chekuri CS473ug Recurrence: Example II Consider T ( n ) = T ( n ) + 1. What is the depth of recursion? n , p n , q p n ,..., O (1) Chekuri CS473ug Recurrence: Example II Consider T ( n ) = T ( n ) + 1. What is the depth of recursion? n , p n , q p n ,..., O (1) Number of levels: n 2 L = 2 means L = log log n Chekuri CS473ug Recurrence: Example II Consider T ( n ) = T ( n ) + 1. What is the depth of recursion? n , p n , q p n ,..., O (1) Number of levels: n 2 L = 2 means L = log log n Number of children at each level is 1, work at each node is 1 Chekuri CS473ug Recurrence: Example II Consider T ( n ) = T ( n ) + 1. What is the depth of recursion? n , p n , q p n ,..., O (1) Number of levels: n 2 L = 2 means L = log log n Number of children at each level is 1, work at each node is 1 Thus, T ( n ) = L i =0 1 = ( L ) = (log log n ). Chekuri CS473ug Recurrence: Example III Consider T ( n ) = nT ( n ) + n . Chekuri CS473ug Recurrence: Example III Consider T ( n ) = nT ( n ) + n . Using recursion trees: number of levels L = log log n Chekuri CS473ug Recurrence: Example III Consider T ( n ) = nT ( n ) + n . Using recursion trees: number of levels L = log log n Work at each level? Root is n , next level is n n = n , so on. Can check that each level is n ....
View
Full
Document
This note was uploaded on 01/22/2012 for the course CS 573 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Chekuri,C
 Algorithms, Recursion

Click to edit the document details