1

By Stirling's Approximation $n! = \sqrt{2*\pi*n} * [n/e]^n * e^\alpha$

Therefore $T(n!) = O(n^n)$

$O(n^n) \neq O(2^{n \lg n})$

Is this correct? Is there another way to get this result if it is correct? Thanks.

Raphael
  • 72,336
  • 29
  • 179
  • 389
so8857
  • 113
  • 3

1 Answers1

1

Remember, big-O is essentially an upper bound so we do have $$ n! = O(n^n) $$ in the sense that there is a constant $c$ for which $n!\le c\;n^n$ eventually. [Note, by the way, that there's no function $T(\cdot)$ involved here.]

Now let's see if $n!=O(2^{n\log n})$. We can argue this way (assuming the log is base-2): $$ 2^{n\log n} = 2^{(\log n) n} = \left(2^{\log n}\right)^n = n^n $$ so we can conclude that the two sets $O(n^n)$ and $O(2^{n\log n})$ are in fact equal.

Rick Decker
  • 14,826
  • 5
  • 42
  • 54
  • Thanks. Would the same logic apply for n! = bigOmega(2^(nlgn))? I believe it would, as n^n is the same as 2^(n lgn) on a graph, thus it is both the upper bound (O) and lower bound (omega). – so8857 Sep 19 '17 at 17:10
  • @so8857. Unfortunately, no. For example, $n^2=O(n^3)$ and $n^3=2^{3\log{n}}$ but neither of these equivalent functions serve as a lower bound for $n^2$. – Rick Decker Sep 19 '17 at 23:47