![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Algorithm to find sum of binomial coefficients of a given positive integer. More...
#include <cassert>#include <cstdint>#include <iostream>Go to the source code of this file.
Namespaces | |
| namespace | math |
| for assert | |
Functions | |
| uint64_t | math::binomialCoeffSum (uint64_t n) |
| static void | test () |
| int | main () |
| Main function. | |
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
Definition in file sum_of_binomial_coefficient.cpp.
| int main | ( | void | ) |
Main function.
Definition at line 64 of file sum_of_binomial_coefficient.cpp.
|
static |
Function for testing binomialCoeffSum function. test cases and assert statement.
Definition at line 38 of file sum_of_binomial_coefficient.cpp.