TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Provides utilities to compute Catalan numbers using dynamic programming. A Catalan numbers satisfy these recurrence relations: C(0) = C(1) = 1; C(n) = sum(C(i).C(n-i-1)), for i = 0 to n-1 Read more about Catalan numbers here: https://en.wikipedia.org/wiki/Catalan_number https://oeis.org/A000108/. More...
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <numeric>
#include <vector>
Go to the source code of this file.
Classes | |
class | catalan_numbers |
computes and caches Catalan numbers More... | |
Functions | |
void | test_catalan_numbers_up_to_20 () |
void | test_catalan_numbers_25 () |
int | main () |
Provides utilities to compute Catalan numbers using dynamic programming. A Catalan numbers satisfy these recurrence relations: C(0) = C(1) = 1; C(n) = sum(C(i).C(n-i-1)), for i = 0 to n-1 Read more about Catalan numbers here: https://en.wikipedia.org/wiki/Catalan_number https://oeis.org/A000108/.
Definition in file catalan_numbers.cpp.
int main | ( | void | ) |
Definition at line 79 of file catalan_numbers.cpp.
void test_catalan_numbers_25 | ( | ) |
Definition at line 73 of file catalan_numbers.cpp.
void test_catalan_numbers_up_to_20 | ( | ) |
Definition at line 47 of file catalan_numbers.cpp.