Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose that algorithm has O($n!$). We all know that $n!$ should be smaller than $2^{2^n}$, but bigger than $2^n$.

So, will O($n!$) be in EXPTIME (EXP)?

Will we able to write O($n!$) as O($2^n$)?

share|cite|improve this question
No -- $n!$ grows faster than $2^n$, and indeed faster than any exponential function. Also, EXPTIME is a class of problems -- its members are subsets of $\Sigma ^*$ (or of $\mathbb N$ or something like that, depending on you precise formalism). It does not contain anything of the form $O(...)$, since $O(...)$ denotes a class of functions rather than a set of finite symbol strings. – Henning Makholm Jul 10 '12 at 11:33
n! grows like $n^{n}$ – tulasi Jul 10 '12 at 11:59
up vote 1 down vote accepted

$n!$ is not $O(2^n)$. The function $n\mapsto n!$ grows much faster that $n\mapsto 2^n$. It is possible for algorithms to be much worse than exponential time.

A perfect example of a $O(n!)$ algorithm is the mean time for the "bozo sort" in which you randomly sort a list of sortables, check if it is in order, and repeat if necessary.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.