0

I just can't solve this problem, I'm new to reccurences. I have this recurrence

$T(n)=n*T(n-1)$
$T(1)=1$

The second term will be:

$T(n-1)=(n-1)*T(n-2)$

And so on.

It's complexity is O(n!) but i don't know how to solve it.

I hope you can help me with an idea!

François
  • 671
  • 5
  • 16
Ruben P
  • 131
  • 4

1 Answers1

0

Hint: Prove by induction on $n$ that $T(n) = n!$.

Note that a recurrence relation doesn't have a complexity. Rather, it defines a function. In many cases, this function is the running time of some algorithm, and then the time complexity of the algorithm is the solution to the recurrence.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514