{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture3 - CS 473 Algorithms Chandra Chekuri...

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

View Full Document Right Arrow Icon
CS 473: Algorithms Chandra Chekuri [email protected] 3228 Siebel Center University of Illinois, Urbana-Champaign Fall 2009 Chekuri CS473ug
Background image of page 1

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

View Full Document Right Arrow Icon
Part I Recurrences Chekuri CS473ug
Background image of page 2
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
Background image of page 3

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

View Full Document Right Arrow Icon
Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Chekuri CS473ug
Background image of page 4
Recurrence: Example I Consider T ( n ) = 2 T ( n / 2) + n / log n . Construct recursion tree, and observe pattern. Chekuri CS473ug
Background image of page 5

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

View Full Document Right Arrow Icon
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
Background image of page 6
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
Background image of page 7

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

View Full Document Right Arrow Icon
Background image of page 8
Background image of page 9

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

View Full Document Right Arrow Icon
Recurrence: Example II Consider T ( n ) = T ( n ) + 1. Chekuri CS473ug
Background image of page 10
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
Background image of page 11

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

View Full Document Right Arrow Icon
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
Background image of page 12
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
Background image of page 13

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

View Full Document Right Arrow Icon
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
Background image of page 14
Recurrence: Example III Consider T ( n ) = nT ( n ) + n . Chekuri CS473ug
Background image of page 15

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

View Full Document Right Arrow Icon
Recurrence: Example III Consider T ( n ) = nT ( n ) + n . Using recursion trees: number of levels L = log log n Chekuri CS473ug
Background image of page 16
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
Background image of page 17

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

View Full Document Right Arrow Icon
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
Background image of page 18
Recurrence: Example IV Consider T ( n ) = T ( n / 4) + T (3 n / 4) + n . Chekuri CS473ug
Background image of page 19

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

View Full Document Right Arrow Icon
Recurrence: Example IV Consider T ( n ) = T ( n / 4) + T (3 n / 4) + n .
Background image of page 20
Image of page 21
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}