Categories

Factorial is faster than Exponential!

Sorry, I was wrong for one of the Jeopardy answers today!

n! is not in O(2n).

It is easy to see that n! < nn, since all the numbers in the product to compute n! are less than (or equal to) n, but this doesn’t prove it is not in O(2n). For that, we can use Sterling’s approximation which gives a tight approximation of the value of n! as


which is definitely not in O(2n) since the base of the exponent is not a constant.

For details, see this wikipedia page.

Sorry I was confused on this today! I was thinking of Fibonacci, which is approximated by φn where φ is the golden ratio (1.618…). This is in O(2n) since 1.618… < 2.

I hope it didn’t change the outcome of the game. As my penance, maybe I should add a question related to this on the final to redeem myself.

Comments are closed.