I know that
log (n!) =log (1) + log(2) + .... log(n-1) + log(n)
and
n*log(n)= log(n) + log(n) + .... + log(n) or just adding log(n)'s n times.
What constant can I multiply n*log(n) that makes it smaller than log(n!)?
I read a few solutions about it being n/2*log(n/2). What constant is that? half?
One solution is from here. Is log(n!) = Θ(n·log(n))?
If C = 1/2, then isn't it just (n/2)*log(n)? How does the n inside of log get affected or why did n become n/2 all of a sudden?
I know the log rule of log(a/b) = log a - log b. Does that rule help?
log(n!) = log(1) + ... + log(n) >= log(n/2) + log(n/2+1) + ... + log(n)
>= n/2*log(n/2) = n/2 *log(n) - n/2*log(2) >= (*) n/2 log(n) - n/4 log(n)
= n/4 log(n) = 1/4 nlog(n)
(*) is because for 'high enough' values of n (n>N for some constant N), n/2log(2) < n/4log(n), so we reduce 'bigger' element - which result in lower outcome.
So, we got that log(n!) >= 1/4*nlog(n) - which gives us that it is in Omega(nlogn) by definition with c=1/4.
Regarding the first part, how we got to log(n/2) + log(n/2+1) + ... +log(n)
log(1) + ... + log(n) >= log(1) + ... + log(n) - log(1) - log(2) - ... - log(n/2-1) =
= log(n/2) + log(n/2+1) + ... + log(n)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With