![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Combinations n choose r function implementation More...
#include <cassert>
#include <cstdint>
#include <iostream>
Go to the source code of this file.
Namespaces | |
namespace | math |
for assert |
Functions | |
template<class T> | |
T | math::n_choose_r (T n, T r) |
This is the function implementation of \( \binom{n}{r} \). | |
static void | test () |
Test implementations. | |
int | main () |
Main function. |
Combinations n choose r function implementation
A very basic and efficient method of calculating choosing r from n different choices. \( \binom{n}{r} = \frac{n!}{r! (n-r)!} \)
Definition in file n_choose_r.cpp.
int main | ( | void | ) |
|
static |
Test implementations.
Definition at line 52 of file n_choose_r.cpp.