what will be the time complexity of the following recurrence relation T(n) = n*T(n-1)

20 Views Asked by At

T(1) = 1 and T(n) = n*T(n-1) when n > 1

Find out the time complexity of the recurrence relation.

After trying out the question my answer is coming out to O(n!). T(n-1) = (n-1) * T(n-2) substituting it in the T(n) T(n) = n * (n-1) * (n-2) . . . after k times T(n) = n * (n-1) * (n-2)...... * T(1) T(n) = O(n!)

Please tell if it is correct or not!

0

There are 0 best solutions below