Unit 1 - Recurrence Relation
Unit 1 - Recurrence Relation
▪ Recurrence Relation
▪ Solving Recurrence Equations
○ Master Theorems
○ Substitution Method
○ Recurrence Tree
▪ Generating Function Techniques
▪ Constructive Induction
Significance:
-Analyzign recursive algorithms
-Optimizing the time complexity pf an algorithm
-Generalize Divide and Conquer
-Develops the problem solving skills .
T(n)=aT(n/b)+Θ(nklogpn)
n Input Size
a No. of subproblems in recursion
n/b size of each subproblem
Θ(nklogpn) Cost of dividing and merging
k k>=0
p Real Number
p>-1
a=bk
P=-1
P<-1
p>=0
a<bk
P<0 Θ(nk)
Tree where each node represents the cost of a certain recursive sub-problem.
sum up the values in each node to get the cost of the entire algorithm.
Steps to solve Recurrence relation using recursion Tree:
1. Draw a recursion tree based on the given recurrence relation
2. Determine-
● Cost of each level
● Total number of levels in the recursion tree
● Number of nodes in the last level
● Cost of the last level
3. Add cost of all the levels of the recursion tree.