I assume that you want to prove that the function n! is an element of the set O(n^n) . This can be proved quite easily:
Definition: A function f(n) is an element of the set O(g(n)) if there exists c>0 such that m exists such that for all k>m we have f(k)<=c*g(k) .
So we have to compare n! with n^n . Let them write one below the other:
n! = n * (n-1) * (n-2) * (n-3) * ... * 3 * 2 * 1 n^n = n * n * n * n * ... * n * n * n
As you can see, the first row ( n! ) And the second row ( n^n ) have exactly n elements on the right side. If we compare these elements, we will see that each element is no larger than the corresponding element in the second row. So n! <= n^n n! <= n^n (at least for n> 5).
So, we can - take a look at the definition - say that there exists c=1 such that there exists m=5 such that for all k>5 we have k! < k^k k! < k^k , which proves that n! really an element of O(n^n) .
source share