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 (int argc, char *argv[]) |
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 | ( | int | argc, |
char * | argv[] ) |
Main function.
argc | commandline argument count (ignored) |
argv | commandline array of arguments (ignored) |
Definition at line 80 of file n_choose_r.cpp.
|
static |
Test implementations.
Definition at line 52 of file n_choose_r.cpp.