{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lecture3 - CS 473 Algorithms Chandra Chekuri...

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

CS 473: Algorithms Chandra Chekuri [email protected] 3228 Siebel Center University of Illinois, Urbana-Champaign Fall 2009 Chekuri CS473ug

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

View Full Document
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

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

View Full Document
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

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

View Full Document
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

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

View Full Document

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

View Full Document
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

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

View Full Document
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

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

View Full Document
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

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

View Full Document
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 . Chekuri CS473ug

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

View Full Document
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 . Thus, T ( n ) = Θ( n log log n ) Chekuri CS473ug
Recurrence: Example IV Consider T ( n ) = T ( n / 4) + T (3 n / 4) + n . Chekuri CS473ug

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

View Full Document
Recurrence: Example IV Consider T ( n ) = T ( n / 4) + T (3 n / 4) + n .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}