Skip to the content of the web site.

Project K.4: Binomial coefficients

Implement the binomial coefficients by calculating the expression ${n \choose k} = \frac{n!}{k!(n - k)!}$.

Implement the binomial coefficients by calculating the expression ${n \choose k} = {n - 1 \choose k} + {n - 1 \choose k - 1}$ where ${n \choose n} = {n \choose 0} = 1$.

The second implementation is beneficial as it does not require calculating a value larger than the actual result; however, it is also very slow.

See what steps you can take to improve your implementation iterative implementation so as to not generate too large an intermediate value.