0

Is it always the case that ${n \choose k} = O(n^k)$?

If it is, then why does the comment from Clement C. in this post state it is only the case when $k$ is a constant?

If it is not, then why is the asymptotic time complexity of the brute force algorithm for the Clique decision problem denoted as ${n \choose k}O(k^2)O(1) = O(n^kk^2)$ even though $k$ may not be a constant?

Also, supposing ${n \choose k} = O(n^k)$, wouldn't it be more precise to state ${n \choose k} = O(n^{\min(k, n-k)})$?

J. Schmidt
  • 807
  • 4
  • 17
  • You have not quoted the comment from Clement C. accurately. $O$ is different from $\Theta$. See https://cs.stackexchange.com/q/57/755. – D.W. Dec 01 '22 at 09:12
  • @D.W. I was wrongfully assuming Clement C. meant to state that ${n \choose k} \neq \Theta(n^k)$ because ${n \choose k} \neq O(n^k)$. I now know he meant to state that ${n \choose k} \neq \Theta(n^k)$ because ${n \choose k} \neq \Omega(n^k)$. (To be fair, this was not clear from the comment.) – J. Schmidt Dec 01 '22 at 14:19

2 Answers2

4

It is always true that $\binom{n}{k} =\mathcal{O}(n^k)$, even if $k$ depends on $n$.

As a proof:

$$\binom{n}{k} = \frac{n!}{k!(n-k)!} = \frac{(n-k+1)(n-k+2)…(n-1)n}{k!}\leqslant \frac{n^k}{k!}\leqslant n^k$$

Since the complexity of the algorithm you talk of is an upper bound, the majoration is correct.

What is wrong, however, is that $\binom{n}{k} = \Theta(n^k)$, when $k$ depends on $n$ (meaning that $n^k$ is not necessarily a lower bound).

For example, $\binom{2n}{n} \sim \frac{4^n}{\sqrt{n\pi}}$ (see here) is not a $\Theta((2n)^n)$.

Nathaniel
  • 15,071
  • 2
  • 27
  • 52
0

In terms of $n$, $$\binom nk=\frac{n(n-1)\cdots(n-k+1)}{k!}$$ is indeed a polynomial in $n$ of degree $k$ (and not of degree $\min(k,n-k)$).

In terms of $k$ (and constant $n$), there is no asymptotic expression as $k\le n$ is required.

If both parameters are variable, the expression is complicated:

$$\Theta\left(\frac{\sqrt{\dfrac n{k(n-k)}}}{\left(\frac kn\right)^k\left(1-\frac kn\right)^{n-k}}\right).$$


A post stating that the brute force algorithm takes time $O(n^kk^2)$ would be misleading because either $k$ is fixed and the asymptotic complexity is just $O(n^k)$, or $k$ is variable and the complexity depends on the above factor.