1Computer Sciences Department
Objectives Recurrences. Substitution Method, Recursion-tree method, Master method
Recurrence 4Computer Sciences Department
A recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs. Example: MERGE-SORT procedure could be described by the recurrence: 5 recurrence Computer Sciences Department
Substitution Method, Recursion-tree method, Master method 6 Recurrence M ethods Computer Sciences Department
The substitution method for solving recurrences entails two steps: 1. Guess the form of the solution. 2. Use mathematical induction to find the constants and show that the solution works. The substitution method can be used to establish either upper or lower bounds on a recurrence. 7 The substitution method Computer Sciences Department
8
As an example, let us determine an upper bound on the recurrence 9 lgn/2=lgn-lg2 Computer Sciences Department
A recursion tree is best used to generate a good guess, which is then verified by the substitution method. Using recursion trees to generate good guesses. 10 The recursion-tree method Computer Sciences Department
11 Solution Computer Sciences Department
12 Solution
Computer Sciences Department13 Solution
Computer Sciences Department14 Solution
Computer Sciences Department15 Solution
16 For example We start by focusing on finding an upper bound for the solution. create a recursion tree for the recurrence we assume that n is an exact power of 4 Computer Sciences Department
17Computer Sciences Department
18Computer Sciences Department
19 guess Computer Sciences Department
20Computer Sciences Department
21 The master method Computer Sciences Department
22Computer Sciences Department
23Computer Sciences Department
24
Computer Sciences Department25
Computer Sciences Department26
Proof of the master theorem (no need) 27Computer Sciences Department