Lecture 1.1.3
Lecture 1.1.3
Subject Code:21CST-260
1. Substitution Method
2. Iteration Method
3. Recursion Tree Method
4. Master Method
Substitution
The Substitution Method Consists of two main steps:
Method
1. Guess the Solution.
2. Use the mathematical induction to find the boundary condition and shows that the guess is
correct.
Iteration Methods
It means to expand the recurrence and express it as a summation of terms of n and initial
condition.
Recursion Tree Method
1. Recursion Tree Method is a pictorial representation of an iteration method which is in the form of a tree
where at each level nodes are expanded.
4. It is sometimes difficult to come up with a good guess. In Recursion tree, each root and child represents the
cost of a single subproblem.
5. We sum the costs within each of the levels of the tree to obtain a set of pre-level costs and then sum all pre-
level costs to determine the total cost of all levels of the recursion.
6. A Recursion Tree is best used to generate a good guess, which can be verified by the Substitution Method.
Example 1
Solution-
We compare the given recurrence relation with T(n) = aT(n/b) + θ (nklogpn).
Then, we have-
a=3b=2k=2p=0
Now, a = 3 and bk = 22 = 4.
Clearly, a < bk.
So, we follow case-03.
Since p = 0, so we have-
T(n) = θ (nklogpn)
T(n) = θ (n2log0n)
Thus, T(n) = θ (n2)
References
1. Lipschutz, S., “Data Structures, Schaum's Outline Series”, 2nd edition (2014), Tata
McGraw Hill.
2. Cormen, Leiserson, Rivest, Stein, “Introduction to Algorithms”, 3rd edition, Prentice
Hall of India.
3. Levitin, “Introduction to the design and analysis of algorithms”, 2nd edition, Pearson.
4. Baase, Van Gerder, “Computer Algorithms: Introduction to Design Analysis”, 3rd
edition, Pearson.
5. Horowitz, Sahni and Rajasekaran, “Fundamental of Computer, Algorithms”, University
Press (India).
6. https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_recurrence
_relation.htm
Thank You