Iterative Method

Distribute Education like Computer Geek
The Second method is the Iterative Method.

The iterative method is excellent because, with this method, you can solve all the recurrence problems. 

Iterative Method:

This means that the recurrence is expanded and expressed as a sum of terms from n and the initial condition. T(1) was the required time in the initial state. To transform the recursion, first, decompose T(n) into sub-problem and then sub-sub-problem and then up to T(1).

 

Solving the Recurrence problem
1. T(n) = T(n – 1) + 1

Iterative method to solve Recurrence Relation T(n) = T(n - 1) + 1

 
2. T(n) = T(n – 1) + n

Iterative method to solve recurrence relation T(n) = T(n - 1) + n

 
3. T(n) = T(n – 1) + n^2

Iterative method to solve recurrence relation T(n) = T(n - 1) + n^2

 
4. T(n) = T(n – 1) + log n

Iterative method to solve recurrence relation T(n) = T(n - 1) + log n

 
5. T(n) = 2T(n – 1) + n

Iterative method to solve recurrence relation T(n) = 2T(n - 1) + n

 
6. T(n) = T(n/2) + n

Iterative method to solve recurrence relation T(n) = T(n/2) + n

 
7. T(n) = 2T(n/2) + 1

Iterative method to solve recurrence relation T(n) = 2T(n/2) + 1

 
8. T(n) = 2T(n/2) + n

Iterative method to solve recurrence relation T(n) = 2T(n/2) + n

 
9. T(n) = T(n/2) + log n

Iterative method to solve recurrence relation T(n) = T(n/2) + log n

 
10. T(n) = 2T(n/2) + n/log n

Iterative method to solve recurrence relation T(n) = 2T(n/2) + n/ log n

Test Yourself

Q1- Solve the recurrence relation
T(n) = T(n-1) + 1/n
Q2- Solve the recurrence relation
T(n) = T(n-1) + √n
Q3- Solve the recurrence relation
T(n) = T(n-1) + 2^n
Q4- Solve the recurrence relation
T(n) = 2T(n-1) + 2^n
Q5- Solve the recurrence relation
T(n) = 2T(n-1) + logn
Q6- Solve the recurrence relation
T(n) = √5T(n-1) + n
Q7- Solve the recurrence relation
T(n) = 4T(n/2) + n^2
Q8- Solve the recurrence relation
T(n) = 3T(n/2) + n
Q9- Solve the recurrence relation
T(n) = 2T(n/3) + n
Q10- Solve the recurrence relation
T(n) = 7T(n/2) + n^2
Q11- Solve the recurrence relation
T(n) = 5/2T(3n/2) + n
Q12- Solve the recurrence relation
T(n) = 2T(n/4) + √n
Q13- Solve the recurrence relation
T(n) = T(n/2) + nlogn
Q14- Solve the recurrence relation
T(n) = 2T(n/2) + logn
Q15- Solve the recurrence relation
T(n) = 2T(n/2) + n/logn

BOOKS

Algorithm T H CoremanAlgorithm by Udit AgarwalAlgorithm Ellis HorowitzData Structure & Algorithm Made Easy Narasimha

Â