|
ADS
Algorithms and Data Structures
|
The examples of the introduction and of section 13.4 of chapter 13: More...
#include "ADS/Contract.h"#include <cstddef>#include <cstdint>#include <vector>#include "ADS/numeric/impl/Combinatorics.tpp"Go to the source code of this file.
Classes | |
| class | ADS::FibonacciCache |
| the numbers of Fibonacci, those computed kept between the calls More... | |
Namespaces | |
| namespace | ADS |
Functions | |
| std::uint64_t | ADS::binomial (int n, int k, long *calls=nullptr) |
| the binomial coefficient \( \binom{n}{k} \) by the recursion; the calls added to *calls, if given | |
| std::vector< std::vector< std::uint64_t > > | ADS::tartaglia (int n) |
| the triangle of Tartaglia, the table of the \( \binom{m}{k} \), \( 0 \le k \le m \le n \) | |
| std::uint64_t | ADS::fibonacciTable (int n) |
| the number \( F_n \) of Fibonacci, \( F_0 = F_1 = 1 \), with a vector | |
| std::uint64_t | ADS::fibonacci (int n) |
| the number \( F_n \) of Fibonacci, \( F_0 = F_1 = 1 \), in \( O( 1 ) \) space | |
| std::uint64_t | ADS::factorial (int n) |
| the factorial \( n! \) by a loop | |
| std::uint64_t | ADS::factorialRec (int n) |
| the factorial \( n! \) by the recursion \( n! = n ( n - 1 )! \), \( 0! = 1 \) | |
| std::uint64_t | ADS::binomialByFactorials (int n, int k) |
| the binomial coefficient \( \binom{n}{k} \) as \( n! / ( k! ( n - k )! ) \) | |
The examples of the introduction and of section 13.4 of chapter 13:
The contracts [see Contract.h]: the results fit in 64 bits, i.e., \( 0 \le k \le n \le 67 \) for binomial() and the triangle, \( 0 \le n \le 92 \) for the numbers of Fibonacci, \( 0 \le n \le 20 \) for the factorial and for binomialByFactorials(). The functions are defined in Combinatorics.tpp.