PPT3 of Pro Next
PPT3 of Pro Next
• The expression:
is a recurrence.
– Recurrence: an equation that describes a function in
terms of its value on smaller functions
Recurrence Examples
Solving Recurrences
• Substitution method
• Iteration method
• Master method
Solving Recurrences
• The substitution method (CLR 4.1)
– “Making a good guess” method
– Guess the form of the answer, then use
induction to find the constants and show that
solution works
– Examples:
• T(n) = 2T(n/2) + Θ(n) T(n) = Θ(n lg n)
• T(n) = 2T(⎣n/2⎦) + n ???
Solving Recurrences
• The substitution method (CLR 4.1)
– “Making a good guess” method
– Guess the form of the answer, then use
induction to find the constants and show that
solution works
– Examples:
• T(n) = 2T(n/2) + Θ(n) T(n) = Θ(n lg n)
• T(n) = 2T(⎣n/2⎦) + n T(n) = Θ(n lg n)
• T(n) = 2T(⎣n/2⎦ )+ 17) + n ???
Substitution method
We require T(2)≤ c 2 lg 2
applies: