0% found this document useful (0 votes)
297 views9 pages

Unit 1 - Recurrence Relation

The document provides an overview of basic concepts related to recurrence relations, including their significance in analyzing and optimizing recursive algorithms. It covers methods for solving recurrence equations such as the Master Theorems, Substitution Method, and Recurrence Trees. Additionally, it categorizes types of recurrence relations and outlines the steps for applying these methods effectively.

Uploaded by

Sujata Sonawane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
297 views9 pages

Unit 1 - Recurrence Relation

The document provides an overview of basic concepts related to recurrence relations, including their significance in analyzing and optimizing recursive algorithms. It covers methods for solving recurrence equations such as the Master Theorems, Substitution Method, and Recurrence Trees. Additionally, it categorizes types of recurrence relations and outlines the steps for applying these methods effectively.

Uploaded by

Sujata Sonawane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 9

UNIT 1 – REVIEW OF BASIC CONCEPTS

▪ Recurrence Relation
▪ Solving Recurrence Equations
○ Master Theorems
○ Substitution Method
○ Recurrence Tree
▪ Generating Function Techniques
▪ Constructive Induction

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 1


Recurrence Relation

Mathematical Expression - defines a sequence in terms of previous term


helps to model the time complexity of recursive algorithms

Significance:
-Analyzign recursive algorithms
-Optimizing the time complexity pf an algorithm
-Generalize Divide and Conquer
-Develops the problem solving skills .

Binary Search T(n) = T(n/2) + 1


Fibonacci Sequence F(n) = F(n-1) + F(n-2)
Factorial Number F(n) = n * F(n-1)

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 2


Types of Recurrence Relation

1. Linear Recurrence relation


○ Solved by Substitution Method
2. Divide and Conquer Recurrences
○ Solved by Master Theorem
3. Substitution Recurrences
○ Convert it into appropriate form then solve by
substitution/master method
4. Homogeneous Recurrences
5. Non-Homogeneous Recurrences

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 3


Substitution Method

1. Guess the solution


2. Use mathematical Induction to prove the guess

● Establishes the upper and lower bound


● Powerful as Recurrences are non-trivial and unreadable via master
theorem.

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 4


Substitution Method

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 5


Master Theorem

Works for only follo. type of recurrences

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

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 6


Master Method
Works for only follo. type of recurrences
a,b relation P value T(n)
T(n)=aT(n/b)+Θ(nklogpn)
a>bk

p>-1
a=bk
P=-1

P<-1

p>=0
a<bk
P<0 Θ(nk)

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 7


Solve Recurrence relation using Master Theorem

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 8


Recurrence Tree

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.

Simplify the expression so obtained in terms of asymptotic notation.

2/20/2025 IOC-DS- Unit 1 by Ms. S. L. Sonawane 9

You might also like