Sample Practice Problems on Complexity Analysis of Algorithms
Prerequisite: Asymptotic Analysis, Worst, Average and Best Cases, Asymptotic Notations, Analysis of loops.Problem 1: Find the complexity of the below recurrence: { 3T(n-1), if n>0,T(n) = { 1, otherwiseSolution: Let us solve using substitution.T(n) = 3T(n-1) = 3(3T(n-2)) = 32T(n-2) = 33T(n-3) ...