We can write the following recurrence relation for f(n) = n!
T(n) = nT(n-1)
T(0) = 1
which , on expanding , will give
T(n) = n * (n-1) * (n-2) * ... * 1
by Stirling's approximation
we can conclude n! = O(nn) .
complexity of log(n!) is also coming from this. we have,
or ln(n!) = O(ln n) .