Download presentation
Presentation is loading. Please wait.
Published bySamson Harrington Modified over 9 years ago
1
1Computer Sciences Department
3
Objectives Recurrences. Substitution Method, Recursion-tree method, Master method
4
Recurrence 4Computer Sciences Department
5
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
6
Substitution Method, Recursion-tree method, Master method 6 Recurrence M ethods Computer Sciences Department
7
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
8
9
As an example, let us determine an upper bound on the recurrence 9 lgn/2=lgn-lg2 Computer Sciences Department
10
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
11 Solution Computer Sciences Department
12
12 Solution
13
Computer Sciences Department13 Solution
14
Computer Sciences Department14 Solution
15
Computer Sciences Department15 Solution
16
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
17
17Computer Sciences Department
18
18Computer Sciences Department
19
19 guess Computer Sciences Department
20
20Computer Sciences Department
21
21 The master method Computer Sciences Department
22
22Computer Sciences Department
23
23Computer Sciences Department
24
24
25
Computer Sciences Department25
26
Computer Sciences Department26
27
Proof of the master theorem (no need) 27Computer Sciences Department
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.