prove that logn! is O(nlogn) using integration
Proof : log(n!) ∈ O(nlog(n))
log(n!) = log(1.2.3.4..........(n-1).n)
Using the property log(ab) = log(a) + log(b) we have,
log(n!) = log(1) + log(2) + log(3) + ....log(n-1) + log(n)
Looking at each term individually, we can say that each term is ≤ log(n). So,
log(n!) ≤ log(n) + log(n) + log(n) + ..................................+ log(n)
Since we are adding n number of log(n)'s we get,
log(n!) ≤ nlog(n)
we know that f(n) = O(g(n)) means there are positive constants c and k, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ k. The values of c and k must be fixed for the function f and must not depend on n.
Using this we can say that,
log(n!) ∈ O(nlog(n)) where c = 1
Hence Proved.