Search code examples
algorithmrecursiontimetime-complexityheapsort

Calculating time complexity in case of recursion algorithms?


How do you calculate time complexity in case of recursion algorithms?

for eg t(n) = t(3n/2) + 0(1) (Heapsort)


Solution

  • Master's theorm is the quick and short way. But since you are trying to learn the complexity for all recursive functions, I would rather suggest you to learn the working of recursion tree, which forms the foundation of Master's Theorm . This link goes on to explain it in detail. Rather than using the Master's theorm blindly, learn this for your better understanding in the future ! This link about recursion tree is a good read too