Find the least integer k such that f(n) is O(nk) for log(n!)

1000 Views Asked by At

I'm trying to get the hang of big O. I know the answer is supposed to be k=2, but whenever I try using my thought process for this problem I get k=1 as the result: I get that log(n!) = log(n)+log(n-1)+...+log(1) From there I have: log(n)+log(n-1)+...+log(1)<=n+log(n)+log(n-1)+...+log(1), and since (and this is where I think I am wrong) n+log(n)+log(n-1)+...+log(1)is O(n), log(n!) = O(n) An explanation on why I am wrong and how to work this problem would by very much appreciated Thank you