Help with proving an equation factorial-time complexity

218 Views Asked by At

I've been recently asked by one of my friends to prove an equation but still, I'm confused how to get it started tho.

log(n!)= θ(nlog(n))

Does anyone know how to help? I'll be very grateful if someone comes to reply to my issue.

Thanks in advance.

1

There are 1 best solutions below

3
On BEST ANSWER

$$O(\log{(n!)})$$$$=O(\log{(n(n-1)(n-2)...(2)(1))})$$$$=O(\log{(n)}+\log{(n-1)}+\log{(n-2)}+...+\log{(2)}+\log{(1)})$$$$=O(n\log{(n))}$$ As $n$ logarithms are added, we have a worst case time complexity of $O(n\log{(n))}$.