Complexity of $\binom{n}{2}$

172 Views Asked by At

So:

$$\binom{n}{2} = \frac{n!}{2!(n-2)!}$$

Using Stirling's approximation we have:

$$\frac{\sqrt{2 \pi n}(\frac{n}{e})^n}{[\sqrt{2 \pi 2}(\frac{2}{e})^2][\sqrt{2 \pi (n-2)}(\frac{(n-2)}{e})^{(n-2)}]}$$

Removing constants and simplifying:

$$\frac{(\frac{n}{e})^n}{(\frac{(n-2)}{e})^{(n-2)}} = \frac{n^n}{e^n} \times \frac{e^{n-2}}{(n-2)^{n-2}} = \frac{n^n}{(n-2)^{(n-2)}}$$

Not sure how to proceed.

1

There are 1 best solutions below

0
On BEST ANSWER

As pointed out in the comments a simplification obviates the need for Sterling's approximation:

$$\binom{n}{2} = \frac{n!}{2!(n-2)!} = \frac{n(n-1)}{2} = \frac{n^2}{2} - \frac{n}{2} = \mathcal{O}(n^2)$$