Recurrence Relations
Recurrence Relations are: Linear Recurrence Relations Divide and Conquer Recurrences Substitution Recurrences Homogeneous Recurrences Non-Homogeneous Recurrences 1. Linear Recurrence Relations: Following are some of the examples of recurrence relations based on linear recurrence relation. T(n) = T(n-1) + n for n > 0 and T(0) = 1 These types of recurrence relations can be easily solved using substitution method . For example, T(n) = T(n-1) + n = T(n-2) + (n-1) + n = T(n-k) + (n-(k-1))….. (n-1) + n Substituting k = n, we get T(n) = T(0) + 1 + 2+….. +n = n(n+1)/2 = O(n^2) 2. Divide and conquer recurrence relations: Following are some of the examples of recurrence relations based on divide and conquer. T(n) = 2T(n/2) + cn T(n) = 2T(n/2) + √n These types of recurrence relations can be easily solved using Master Method . For recurrence relation: T(n) = 2T(n/2) + cn, the values of a = 2, b = 2 and k =1. Here logb(a) = log2(2) = 1 = k. Therefore, t...