|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Algorithm to find sum of binomial coefficients of a given positive integer. More...
#include <cassert>#include <iostream>Namespaces | |
| namespace | math |
| for std::rand | |
Functions | |
| uint64_t | math::binomialCoeffSum (uint64_t n) |
| static void | test () |
| int | main () |
| Main function. More... | |
Algorithm to find sum of binomial coefficients of a given positive integer.
Given a positive integer n, the task is to find the sum of binomial coefficient i.e nC0 + nC1 + nC2 + ... + nCn-1 + nCn By induction, we can prove that the sum is equal to 2^n
| int main | ( | void | ) |
|
static |
Function for testing binomialCoeffSum function. test cases and assert statement.
void