diff --git a/d2/d96/factorial__memoization_8cpp.html b/d2/d96/factorial__memoization_8cpp.html new file mode 100644 index 000000000..cc3f3fa9a --- /dev/null +++ b/d2/d96/factorial__memoization_8cpp.html @@ -0,0 +1,260 @@ + + + + + + + + +TheAlgorithms/C++: math/factorial_memoization.cpp File Reference + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
TheAlgorithms/C++ 1.0.0 +
+
All the algorithms implemented in C++
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
factorial_memoization.cpp File Reference
+
+
+ +

Factorial calculation using recursion and memoization +More...

+
#include <iostream>
+#include <cassert>
+#include <array>
+#include <cstdint>
+
+Include dependency graph for factorial_memoization.cpp:
+
+
+
+
+

Go to the source code of this file.

+ + + + +

+Namespaces

namespace  math
 for assert
+ + + + + + + +

+Functions

uint64_t math::fact_recursion (uint64_t n)
 Computes the factorial of a non-negative integer using recursion and memoization.
void test_fact_recursion ()
 Self-test implementations for the fact_recursion function.
int main ()
 Main function to run test cases and interact with the user.
+ + + +

+Variables

std::array< uint64_t, 1000 > memo {0}
 Array to store computed factorials for memoization.
+

Detailed Description

+

Factorial calculation using recursion and memoization

+

This program computes the factorial of a non-negative integer using recursion with memoization (top-down dynamic programming). It stores intermediate results to avoid redundant calculations for improved efficiency.

+

Memoization is a form of caching where the result to an expensive function call is stored and returned. Example: Input: n = 5 Output: 120

+

Explanation: 5! = 5 × 4 × 3 × 2 × 1 = 120

+

The program uses a recursive function fact_recursion which caches computed results in a memo array to avoid recalculating factorials for the same numbers.

+

Time Complexity: O(n) Space Complexity: O(n)

Author
Vedant Mukhedkar
+ +

Definition in file factorial_memoization.cpp.

+

Function Documentation

+ +

◆ main()

+ +
+
+ + + + + + + +
int main (void )
+
+ +

Main function to run test cases and interact with the user.

+
Returns
0 on program success
+ +

Definition at line 69 of file factorial_memoization.cpp.

+
69 {
+
70 // Run test cases
+ +
72 return 0;
+
73}
+
void test_fact_recursion()
Self-test implementations for the fact_recursion function.
+
+
+
+ +

◆ test_fact_recursion()

+ +
+
+ + + + + + + +
void test_fact_recursion ()
+
+ +

Self-test implementations for the fact_recursion function.

+
Returns
void
+ +

Definition at line 56 of file factorial_memoization.cpp.

+
56 {
+
57 // Test cases for factorial computation
+
58 assert(math::fact_recursion(0) == 1);
+
59 assert(math::fact_recursion(1) == 1);
+
60 assert(math::fact_recursion(5) == 120);
+
61 assert(math::fact_recursion(10) == 3628800);
+
62 std::cout << "All test cases passed!\n";
+
63}
+
uint64_t fact_recursion(uint64_t n)
Computes the factorial of a non-negative integer using recursion and memoization.
+
+
+
+

Variable Documentation

+ +

◆ memo

+ +
+
+ + + + +
std::array<uint64_t, 1000> memo {0}
+
+ +

Array to store computed factorials for memoization.

+ +

Definition at line 31 of file factorial_memoization.cpp.

+
31{0};
+
+
+
+
+
+ +
+ + + + diff --git a/d2/d96/factorial__memoization_8cpp.js b/d2/d96/factorial__memoization_8cpp.js new file mode 100644 index 000000000..a1f95b83c --- /dev/null +++ b/d2/d96/factorial__memoization_8cpp.js @@ -0,0 +1,7 @@ +var factorial__memoization_8cpp = +[ + [ "math::fact_recursion", "dd/d47/namespacemath.html#a73b07abea036f1ce2e3ac5dc169bdb4b", null ], + [ "main", "d2/d96/factorial__memoization_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "test_fact_recursion", "d2/d96/factorial__memoization_8cpp.html#a4243a60d73b9e1296de20196d5b155ba", null ], + [ "memo", "d2/d96/factorial__memoization_8cpp.html#a0f9b4d5fae79e1029daf9bd1b93ec217", null ] +]; \ No newline at end of file diff --git a/d2/d96/factorial__memoization_8cpp_source.html b/d2/d96/factorial__memoization_8cpp_source.html new file mode 100644 index 000000000..5baa57336 --- /dev/null +++ b/d2/d96/factorial__memoization_8cpp_source.html @@ -0,0 +1,174 @@ + + + + + + + + +TheAlgorithms/C++: math/factorial_memoization.cpp Source File + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
TheAlgorithms/C++ 1.0.0 +
+
All the algorithms implemented in C++
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
factorial_memoization.cpp
+
+
+Go to the documentation of this file.
1
+
24
+
25#include <iostream> // for std::cout
+
26#include <cassert> // For test cases
+
27#include <array> // For std::array
+
28#include <cstdint> // For uint64_t
+
29
+
31std::array<uint64_t, 1000> memo{0};
+
32
+
37namespace math {
+
38
+
+
44uint64_t fact_recursion(uint64_t n) {
+
45 if (n == 0) return 1; // Base case: 0! = 1
+
46 if (memo[n] != 0) return memo[n]; // Return already computed value
+
47 memo[n] = n * fact_recursion(n - 1); // Store and return the computed value
+
48 return memo[n];
+
49}
+
+
50
+
51} // namespace math
+
+ +
57 // Test cases for factorial computation
+
58 assert(math::fact_recursion(0) == 1);
+
59 assert(math::fact_recursion(1) == 1);
+
60 assert(math::fact_recursion(5) == 120);
+
61 assert(math::fact_recursion(10) == 3628800);
+
62 std::cout << "All test cases passed!\n";
+
63}
+
+
64
+
+
69int main() {
+
70 // Run test cases
+ +
72 return 0;
+
73}
+
+
std::array< uint64_t, 1000 > memo
Array to store computed factorials for memoization.
+
void test_fact_recursion()
Self-test implementations for the fact_recursion function.
+
int main()
Main function to run test cases and interact with the user.
+
for assert
+
uint64_t fact_recursion(uint64_t n)
Computes the factorial of a non-negative integer using recursion and memoization.
+
+
+
+ + + + diff --git a/d7/d73/abbreviation_8cpp.html b/d7/d73/abbreviation_8cpp.html index 9a7e81ace..137da0213 100644 --- a/d7/d73/abbreviation_8cpp.html +++ b/d7/d73/abbreviation_8cpp.html @@ -141,7 +141,7 @@ Namespaces - + @@ -200,32 +200,33 @@ Algorithm

Definition at line 119 of file abbreviation.cpp.

119 {
-
120 std::vector<std::vector<bool>> memo(
+
120 std::vector<std::vector<bool>> memo(
121 str.size() + 1, std::vector<bool>(result.size() + 1, false));
122
123 for (uint32_t i = 0; i <= str.size(); ++i) {
-
124 memo[i][0] = true;
+
124 memo[i][0] = true;
125 }
126 for (uint32_t i = 1; i <= result.size(); ++i) {
-
127 memo[0][i] = false;
+
127 memo[0][i] = false;
128 }
129 for (uint32_t i = 1; i <= str.size(); ++i) {
130 for (uint32_t j = 1; j <= result.size(); ++j) {
131 if (str[i - 1] == result[j - 1]) {
-
132 memo[i][j] = memo[i - 1][j - 1];
+
132 memo[i][j] = memo[i - 1][j - 1];
133 } else if (str[i - 1] - 32 == result[j - 1]) {
-
134 memo[i][j] = (memo[i - 1][j - 1] || memo[i - 1][j]);
+
134 memo[i][j] = (memo[i - 1][j - 1] || memo[i - 1][j]);
135 } else {
136 if (str[i - 1] >= 'A' && str[i - 1] <= 'Z') {
-
137 memo[i][j] = false;
+
137 memo[i][j] = false;
138 } else {
-
139 memo[i][j] = memo[i - 1][j];
+
139 memo[i][j] = memo[i - 1][j];
140 }
141 }
142 }
143 }
-
144 return memo.back().back();
+
144 return memo.back().back();
145}
+
std::array< uint64_t, 1000 > memo
Array to store computed factorials for memoization.
@@ -291,7 +292,7 @@ j)

Definition at line 59 of file abbreviation.cpp.

62 {
-
63 bool ans = memo->at(str_idx).at(result_idx);
+
63 bool ans = memo->at(str_idx).at(result_idx);
64 if (str_idx == str.size() && result_idx == result.size()) {
65 return true;
66 } else if (str_idx == str.size() && result_idx != result.size()) {
@@ -299,12 +300,12 @@ j)
68 return false;
69 } else if (!visited->at(str_idx).at(result_idx)) {
81 if (str[str_idx] == result[result_idx]) {
-
82 ans = abbreviation_recursion(memo, visited, str, result,
+
82 ans = abbreviation_recursion(memo, visited, str, result,
83 str_idx + 1, result_idx + 1);
84 } else if (str[str_idx] - 32 == result[result_idx]) {
-
85 ans = abbreviation_recursion(memo, visited, str, result,
+
85 ans = abbreviation_recursion(memo, visited, str, result,
86 str_idx + 1, result_idx + 1) ||
-
87 abbreviation_recursion(memo, visited, str, result,
+
87 abbreviation_recursion(memo, visited, str, result,
88 str_idx + 1, result_idx);
89 } else {
90 // if `str[i]` is uppercase, then cannot be converted, return
@@ -314,14 +315,14 @@ j)
94 if (str[str_idx] >= 'A' && str[str_idx] <= 'Z') {
95 ans = false;
96 } else {
-
97 ans = abbreviation_recursion(memo, visited, str, result,
+
97 ans = abbreviation_recursion(memo, visited, str, result,
98 str_idx + 1, result_idx);
99 }
100 }
101 }
102 (*memo)[str_idx][result_idx] = ans;
103 (*visited)[str_idx][result_idx] = true;
-
104 return (*memo)[str_idx][result_idx];
+
104 return (*memo)[str_idx][result_idx];
105}
bool abbreviation_recursion(std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0)
Recursive Dynamic Programming function.
@@ -383,36 +384,36 @@ j)

Definition at line 153 of file abbreviation.cpp.

153 {
154 std::string s = "daBcd", t = "ABC";
-
155 std::vector<std::vector<bool>> memo(s.size() + 1,
+
155 std::vector<std::vector<bool>> memo(s.size() + 1,
156 std::vector<bool>(t.size() + 1, false)),
157 visited(s.size() + 1, std::vector<bool>(t.size() + 1, false));
158
159 assert(dynamic_programming::abbreviation::abbreviation_recursion(
-
160 &memo, &visited, s, t) == true);
+
160 &memo, &visited, s, t) == true);
161 assert(dynamic_programming::abbreviation::abbreviation(s, t) == true);
162 s = "XXVVnDEFYgYeMXzWINQYHAQKKOZEYgSRCzLZAmUYGUGILjMDET";
163 t = "XXVVDEFYYMXWINQYHAQKKOZEYSRCLZAUYGUGILMDETQVWU";
-
164 memo = std::vector<std::vector<bool>>(
+
164 memo = std::vector<std::vector<bool>>(
165 s.size() + 1, std::vector<bool>(t.size() + 1, false));
166
167 visited = std::vector<std::vector<bool>>(
168 s.size() + 1, std::vector<bool>(t.size() + 1, false));
169
170 assert(dynamic_programming::abbreviation::abbreviation_recursion(
-
171 &memo, &visited, s, t) == false);
+
171 &memo, &visited, s, t) == false);
172 assert(dynamic_programming::abbreviation::abbreviation(s, t) == false);
173
174 s = "DRFNLZZVHLPZWIupjwdmqafmgkg";
175 t = "DRFNLZZVHLPZWI";
176
-
177 memo = std::vector<std::vector<bool>>(
+
177 memo = std::vector<std::vector<bool>>(
178 s.size() + 1, std::vector<bool>(t.size() + 1, false));
179
180 visited = std::vector<std::vector<bool>>(
181 s.size() + 1, std::vector<bool>(t.size() + 1, false));
182
183 assert(dynamic_programming::abbreviation::abbreviation_recursion(
-
184 &memo, &visited, s, t) == true);
+
184 &memo, &visited, s, t) == true);
185 assert(dynamic_programming::abbreviation::abbreviation(s, t) == true);
186}
bool abbreviation(const std::string &str, const std::string &result)
Iterative Dynamic Programming function.
diff --git a/d7/d73/abbreviation_8cpp_source.html b/d7/d73/abbreviation_8cpp_source.html index 95d656087..61afb1eec 100644 --- a/d7/d73/abbreviation_8cpp_source.html +++ b/d7/d73/abbreviation_8cpp_source.html @@ -126,11 +126,11 @@ $(function(){initNavTree('d7/d73/abbreviation_8cpp_source.html','../../',''); })
35namespace dynamic_programming {
42namespace abbreviation {
-
59bool abbreviation_recursion(std::vector<std::vector<bool>> *memo,
+
59bool abbreviation_recursion(std::vector<std::vector<bool>> *memo,
60 std::vector<std::vector<bool>> *visited,
61 const std::string &str, const std::string &result,
62 uint32_t str_idx = 0, uint32_t result_idx = 0) {
-
63 bool ans = memo->at(str_idx).at(result_idx);
+
63 bool ans = memo->at(str_idx).at(result_idx);
64 if (str_idx == str.size() && result_idx == result.size()) {
65 return true;
66 } else if (str_idx == str.size() && result_idx != result.size()) {
@@ -138,12 +138,12 @@ $(function(){initNavTree('d7/d73/abbreviation_8cpp_source.html','../../',''); })
68 return false;
69 } else if (!visited->at(str_idx).at(result_idx)) {
81 if (str[str_idx] == result[result_idx]) {
-
82 ans = abbreviation_recursion(memo, visited, str, result,
+
82 ans = abbreviation_recursion(memo, visited, str, result,
83 str_idx + 1, result_idx + 1);
84 } else if (str[str_idx] - 32 == result[result_idx]) {
-
85 ans = abbreviation_recursion(memo, visited, str, result,
+
85 ans = abbreviation_recursion(memo, visited, str, result,
86 str_idx + 1, result_idx + 1) ||
-
87 abbreviation_recursion(memo, visited, str, result,
+
87 abbreviation_recursion(memo, visited, str, result,
88 str_idx + 1, result_idx);
89 } else {
90 // if `str[i]` is uppercase, then cannot be converted, return
@@ -153,44 +153,44 @@ $(function(){initNavTree('d7/d73/abbreviation_8cpp_source.html','../../',''); })
94 if (str[str_idx] >= 'A' && str[str_idx] <= 'Z') {
95 ans = false;
96 } else {
-
97 ans = abbreviation_recursion(memo, visited, str, result,
+
97 ans = abbreviation_recursion(memo, visited, str, result,
98 str_idx + 1, result_idx);
99 }
100 }
101 }
102 (*memo)[str_idx][result_idx] = ans;
103 (*visited)[str_idx][result_idx] = true;
-
104 return (*memo)[str_idx][result_idx];
+
104 return (*memo)[str_idx][result_idx];
105}
106
119bool abbreviation(const std::string &str, const std::string &result) {
-
120 std::vector<std::vector<bool>> memo(
+
120 std::vector<std::vector<bool>> memo(
121 str.size() + 1, std::vector<bool>(result.size() + 1, false));
122
123 for (uint32_t i = 0; i <= str.size(); ++i) {
-
124 memo[i][0] = true;
+
124 memo[i][0] = true;
125 }
126 for (uint32_t i = 1; i <= result.size(); ++i) {
-
127 memo[0][i] = false;
+
127 memo[0][i] = false;
128 }
129 for (uint32_t i = 1; i <= str.size(); ++i) {
130 for (uint32_t j = 1; j <= result.size(); ++j) {
131 if (str[i - 1] == result[j - 1]) {
-
132 memo[i][j] = memo[i - 1][j - 1];
+
132 memo[i][j] = memo[i - 1][j - 1];
133 } else if (str[i - 1] - 32 == result[j - 1]) {
-
134 memo[i][j] = (memo[i - 1][j - 1] || memo[i - 1][j]);
+
134 memo[i][j] = (memo[i - 1][j - 1] || memo[i - 1][j]);
135 } else {
136 if (str[i - 1] >= 'A' && str[i - 1] <= 'Z') {
-
137 memo[i][j] = false;
+
137 memo[i][j] = false;
138 } else {
-
139 memo[i][j] = memo[i - 1][j];
+
139 memo[i][j] = memo[i - 1][j];
140 }
141 }
142 }
143 }
-
144 return memo.back().back();
+
144 return memo.back().back();
145}
146} // namespace abbreviation
@@ -199,36 +199,36 @@ $(function(){initNavTree('d7/d73/abbreviation_8cpp_source.html','../../',''); })
153static void test() {
154 std::string s = "daBcd", t = "ABC";
-
155 std::vector<std::vector<bool>> memo(s.size() + 1,
+
155 std::vector<std::vector<bool>> memo(s.size() + 1,
156 std::vector<bool>(t.size() + 1, false)),
157 visited(s.size() + 1, std::vector<bool>(t.size() + 1, false));
158
-
160 &memo, &visited, s, t) == true);
+
160 &memo, &visited, s, t) == true);
162 s = "XXVVnDEFYgYeMXzWINQYHAQKKOZEYgSRCzLZAmUYGUGILjMDET";
163 t = "XXVVDEFYYMXWINQYHAQKKOZEYSRCLZAUYGUGILMDETQVWU";
-
164 memo = std::vector<std::vector<bool>>(
+
164 memo = std::vector<std::vector<bool>>(
165 s.size() + 1, std::vector<bool>(t.size() + 1, false));
166
167 visited = std::vector<std::vector<bool>>(
168 s.size() + 1, std::vector<bool>(t.size() + 1, false));
169
-
171 &memo, &visited, s, t) == false);
+
171 &memo, &visited, s, t) == false);
173
174 s = "DRFNLZZVHLPZWIupjwdmqafmgkg";
175 t = "DRFNLZZVHLPZWI";
176
-
177 memo = std::vector<std::vector<bool>>(
+
177 memo = std::vector<std::vector<bool>>(
178 s.size() + 1, std::vector<bool>(t.size() + 1, false));
179
180 visited = std::vector<std::vector<bool>>(
181 s.size() + 1, std::vector<bool>(t.size() + 1, false));
182
-
184 &memo, &visited, s, t) == true);
+
184 &memo, &visited, s, t) == true);
186}
@@ -243,6 +243,7 @@ $(function(){initNavTree('d7/d73/abbreviation_8cpp_source.html','../../',''); })
bool abbreviation_recursion(std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0)
Recursive Dynamic Programming function.
int main()
Main function.
bool abbreviation(const std::string &str, const std::string &result)
Iterative Dynamic Programming function.
+
std::array< uint64_t, 1000 > memo
Array to store computed factorials for memoization.
Functions for Abbreviation implementation.
Dynamic Programming algorithms.
diff --git a/db/d30/factorial__memoization_8cpp__incl.map b/db/d30/factorial__memoization_8cpp__incl.map new file mode 100644 index 000000000..cd5e16a47 --- /dev/null +++ b/db/d30/factorial__memoization_8cpp__incl.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/db/d30/factorial__memoization_8cpp__incl.md5 b/db/d30/factorial__memoization_8cpp__incl.md5 new file mode 100644 index 000000000..b566ca4d8 --- /dev/null +++ b/db/d30/factorial__memoization_8cpp__incl.md5 @@ -0,0 +1 @@ +69fc891120320fb84e290bfcf9cb1ff5 \ No newline at end of file diff --git a/db/d30/factorial__memoization_8cpp__incl.svg b/db/d30/factorial__memoization_8cpp__incl.svg new file mode 100644 index 000000000..84202a3b6 --- /dev/null +++ b/db/d30/factorial__memoization_8cpp__incl.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + +math/factorial_memoization.cpp + + +Node1 + + +math/factorial_memoization.cpp + + + + + +Node2 + + +iostream + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cassert + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +array + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +cstdint + + + + + +Node1->Node5 + + + + + + + + + + + + + diff --git a/db/d30/factorial__memoization_8cpp__incl_org.svg b/db/d30/factorial__memoization_8cpp__incl_org.svg new file mode 100644 index 000000000..0b15a8144 --- /dev/null +++ b/db/d30/factorial__memoization_8cpp__incl_org.svg @@ -0,0 +1,93 @@ + + + + + + +math/factorial_memoization.cpp + + +Node1 + + +math/factorial_memoization.cpp + + + + + +Node2 + + +iostream + + + + + +Node1->Node2 + + + + + + + + +Node3 + + +cassert + + + + + +Node1->Node3 + + + + + + + + +Node4 + + +array + + + + + +Node1->Node4 + + + + + + + + +Node5 + + +cstdint + + + + + +Node1->Node5 + + + + + + + + diff --git a/dd/d47/namespacemath.html b/dd/d47/namespacemath.html index 4251ef948..4c23c781e 100644 --- a/dd/d47/namespacemath.html +++ b/dd/d47/namespacemath.html @@ -174,6 +174,8 @@ Functions + + @@ -245,8 +247,8 @@ Functions

std::cout

for IO implementations

Evaluate recurrence relation using matrix exponentiation.

-

Math algorithms.

for mathematical functions

+

Math algorithms.

Mathematical algorithms.

for IO operations

for M_PI definition and pow()

@@ -819,6 +821,42 @@ template<typename T> + +

◆ fact_recursion()

+ +
+
+

Functions

bool dynamic_programming::abbreviation::abbreviation_recursion (std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0)
bool dynamic_programming::abbreviation::abbreviation_recursion (std::vector< std::vector< bool > > *memo, std::vector< std::vector< bool > > *visited, const std::string &str, const std::string &result, uint32_t str_idx=0, uint32_t result_idx=0)
 Recursive Dynamic Programming function.
bool dynamic_programming::abbreviation::abbreviation (const std::string &str, const std::string &result)
 Iterative Dynamic Programming function.
 Function to calculate Euler's Totient.
uint64_t factorial (uint8_t n)
 function to find factorial of given number
uint64_t fact_recursion (uint64_t n)
 Computes the factorial of a non-negative integer using recursion and memoization.
double integral_approx (double lb, double ub, const std::function< double(double)> &func, double delta=.0001)
 Computes integral approximation.
void test_eval (double approx, double expected, double threshold)
+ + + + + + +
uint64_t math::fact_recursion (uint64_t n)
+
+ +

Computes the factorial of a non-negative integer using recursion and memoization.

+
Parameters
+ + +
nThe integer whose factorial is to be computed
+
+
+
Returns
The factorial of n
+ +

Definition at line 44 of file factorial_memoization.cpp.

+
44 {
+
45 if (n == 0) return 1; // Base case: 0! = 1
+
46 if (memo[n] != 0) return memo[n]; // Return already computed value
+
47 memo[n] = n * fact_recursion(n - 1); // Store and return the computed value
+
48 return memo[n];
+
49}
+
std::array< uint64_t, 1000 > memo
Array to store computed factorials for memoization.
+
uint64_t fact_recursion(uint64_t n)
Computes the factorial of a non-negative integer using recursion and memoization.
+
+
+

◆ factorial()

diff --git a/dd/d47/namespacemath.js b/dd/d47/namespacemath.js index 617f04a36..d81337f4b 100644 --- a/dd/d47/namespacemath.js +++ b/dd/d47/namespacemath.js @@ -14,6 +14,7 @@ var namespacemath = [ "cylinder_surface_area", "dd/d47/namespacemath.html#ac5803413618fcfb922cb32c6db0fc864", null ], [ "cylinder_surface_perimeter", "dd/d47/namespacemath.html#a1d4df7a4e43a2eac1acc0ac610487c73", null ], [ "cylinder_volume", "dd/d47/namespacemath.html#abde24398be43538c62e4a496968e60ca", null ], + [ "fact_recursion", "dd/d47/namespacemath.html#a73b07abea036f1ce2e3ac5dc169bdb4b", null ], [ "factorial", "dd/d47/namespacemath.html#a7e78996673df791014cfe540b183456a", null ], [ "hemi_sphere_surface_area", "dd/d47/namespacemath.html#a3277e65a8f380e7632791975bfba0efb", null ], [ "integral_approx", "dd/d47/namespacemath.html#aec65db4e5c7317323227f026fe50ef11", null ], diff --git a/dir_296d53ceaeaa7e099814a6def439fe8a.html b/dir_296d53ceaeaa7e099814a6def439fe8a.html index 2bdea840d..4a4ddd908 100644 --- a/dir_296d53ceaeaa7e099814a6def439fe8a.html +++ b/dir_296d53ceaeaa7e099814a6def439fe8a.html @@ -148,6 +148,8 @@ Files  GCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)
 factorial.cpp  Find the factorial of a given number.
+
 factorial_memoization.cppFactorial calculation using recursion and memoization
 fast_power.cpp  Faster computation for \(a^b\).
 fibonacci.cpp diff --git a/dir_296d53ceaeaa7e099814a6def439fe8a.js b/dir_296d53ceaeaa7e099814a6def439fe8a.js index ca21c717a..247619374 100644 --- a/dir_296d53ceaeaa7e099814a6def439fe8a.js +++ b/dir_296d53ceaeaa7e099814a6def439fe8a.js @@ -15,6 +15,7 @@ var dir_296d53ceaeaa7e099814a6def439fe8a = [ "eulers_totient_function.cpp", "da/d23/eulers__totient__function_8cpp.html", "da/d23/eulers__totient__function_8cpp" ], [ "extended_euclid_algorithm.cpp", "d9/d5d/extended__euclid__algorithm_8cpp.html", "d9/d5d/extended__euclid__algorithm_8cpp" ], [ "factorial.cpp", "d9/d00/factorial_8cpp.html", "d9/d00/factorial_8cpp" ], + [ "factorial_memoization.cpp", "d2/d96/factorial__memoization_8cpp.html", "d2/d96/factorial__memoization_8cpp" ], [ "fast_power.cpp", "d2/d0b/fast__power_8cpp.html", "d2/d0b/fast__power_8cpp" ], [ "fibonacci.cpp", "d9/d89/fibonacci_8cpp.html", "d9/d89/fibonacci_8cpp" ], [ "fibonacci_fast.cpp", "d4/d32/fibonacci__fast_8cpp.html", "d4/d32/fibonacci__fast_8cpp" ], diff --git a/doxygen_crawl.html b/doxygen_crawl.html index 6448e2521..5c261a5e3 100644 --- a/doxygen_crawl.html +++ b/doxygen_crawl.html @@ -485,6 +485,11 @@ + + + + + @@ -2837,6 +2842,7 @@ + diff --git a/files.html b/files.html index b2ba53aa6..4d6235ac6 100644 --- a/files.html +++ b/files.html @@ -315,54 +315,55 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm  
eulers_totient_function.cppImplementation of Euler's Totient @description Euler Totient Function is also known as phi function  
extended_euclid_algorithm.cppGCD using [extended Euclid's algorithm] (https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)  
factorial.cppFind the factorial of a given number - 
fast_power.cppFaster computation for \(a^b\) - 
fibonacci.cppN-th Fibonacci number - 
fibonacci_fast.cppFaster computation of Fibonacci series - 
fibonacci_large.cppComputes N^th Fibonacci number given as input argument. Uses custom build arbitrary integers library to perform additions and other operations - 
fibonacci_matrix_exponentiation.cppThis program computes the N^th Fibonacci number in modulo mod input argument - 
fibonacci_sum.cppAn algorithm to calculate the sum of Fibonacci Sequence: \(\mathrm{F}(n) + + 
factorial_memoization.cppFactorial calculation using recursion and memoization + 
fast_power.cppFaster computation for \(a^b\) + 
fibonacci.cppN-th Fibonacci number + 
fibonacci_fast.cppFaster computation of Fibonacci series + 
fibonacci_large.cppComputes N^th Fibonacci number given as input argument. Uses custom build arbitrary integers library to perform additions and other operations + 
fibonacci_matrix_exponentiation.cppThis program computes the N^th Fibonacci number in modulo mod input argument + 
fibonacci_sum.cppAn algorithm to calculate the sum of Fibonacci Sequence: \(\mathrm{F}(n) + \mathrm{F}(n+1) + .. + \mathrm{F}(m)\) - 
finding_number_of_digits_in_a_number.cpp[Program to count digits in an integer](https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods) - 
gcd_iterative_euclidean.cppCompute the greatest common denominator of two integers using iterative form of Euclidean algorithm - 
gcd_of_n_numbers.cppThis program aims at calculating the GCD of n numbers - 
gcd_recursive_euclidean.cppCompute the greatest common denominator of two integers using recursive form of Euclidean algorithm - 
integral_approximation.cppCompute integral approximation of the function using Riemann sum - 
integral_approximation2.cppMonte Carlo Integration - 
inv_sqrt.cppImplementation of the inverse square root Root - 
iterative_factorial.cppIterative implementation of Factorial - 
large_factorial.cppCompute factorial of any arbitratily large number/ - 
large_number.hLibrary to perform arithmatic operations on arbitrarily large numbers - 
largest_power.cppAlgorithm to find largest x such that p^x divides n! (factorial) using Legendre's Formula - 
lcm_sum.cppAn algorithm to calculate the sum of LCM: \(\mathrm{LCM}(1,n) + + 
finding_number_of_digits_in_a_number.cpp[Program to count digits in an integer](https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods) + 
gcd_iterative_euclidean.cppCompute the greatest common denominator of two integers using iterative form of Euclidean algorithm + 
gcd_of_n_numbers.cppThis program aims at calculating the GCD of n numbers + 
gcd_recursive_euclidean.cppCompute the greatest common denominator of two integers using recursive form of Euclidean algorithm + 
integral_approximation.cppCompute integral approximation of the function using Riemann sum + 
integral_approximation2.cppMonte Carlo Integration + 
inv_sqrt.cppImplementation of the inverse square root Root + 
iterative_factorial.cppIterative implementation of Factorial + 
large_factorial.cppCompute factorial of any arbitratily large number/ + 
large_number.hLibrary to perform arithmatic operations on arbitrarily large numbers + 
largest_power.cppAlgorithm to find largest x such that p^x divides n! (factorial) using Legendre's Formula + 
lcm_sum.cppAn algorithm to calculate the sum of LCM: \(\mathrm{LCM}(1,n) + \mathrm{LCM}(2,n) + \ldots + \mathrm{LCM}(n,n)\) - 
least_common_multiple.cpp - 
linear_recurrence_matrix.cpp - 
magic_number.cppA simple program to check if the given number is a magic number or not. A number is said to be a magic number, if the sum of its digits are calculated till a single digit recursively by adding the sum of the digits after every addition. If the single digit comes out to be 1,then the number is a magic number - 
miller_rabin.cpp - 
modular_division.cppAn algorithm to divide two numbers under modulo p Modular Division - 
modular_exponentiation.cppC++ Program for Modular Exponentiation Iteratively - 
modular_inverse_fermat_little_theorem.cppC++ Program to find the modular inverse using Fermat's Little Theorem - 
modular_inverse_simple.cppSimple implementation of modular multiplicative inverse - 
n_bonacci.cppImplementation of the N-bonacci series - 
n_choose_r.cppCombinations n choose r function implementation - 
ncr_modulo_p.cppThis program aims at calculating nCr modulo p - 
number_of_positive_divisors.cppC++ Program to calculate the number of positive divisors - 
perimeter.cppImplementations for the perimeter of various shapes - 
power_for_huge_numbers.cppCompute powers of large numbers - 
power_of_two.cppImplementation to check whether a number is a power of 2 or not - 
prime_factorization.cppPrime factorization of positive integers - 
prime_numbers.cppGet list of prime numbers - 
primes_up_to_billion.cppCompute prime numbers upto 1 billion - 
quadratic_equations_complex_numbers.cppCalculate quadratic equation with complex roots, i.e. b^2 - 4ac < 0 - 
realtime_stats.cppCompute statistics for data entered in rreal-time - 
sieve_of_eratosthenes.cppPrime Numbers using Sieve of Eratosthenes - 
sqrt_double.cppCalculate the square root of any positive real number in \(O(\log + 
least_common_multiple.cpp + 
linear_recurrence_matrix.cpp + 
magic_number.cppA simple program to check if the given number is a magic number or not. A number is said to be a magic number, if the sum of its digits are calculated till a single digit recursively by adding the sum of the digits after every addition. If the single digit comes out to be 1,then the number is a magic number + 
miller_rabin.cpp + 
modular_division.cppAn algorithm to divide two numbers under modulo p Modular Division + 
modular_exponentiation.cppC++ Program for Modular Exponentiation Iteratively + 
modular_inverse_fermat_little_theorem.cppC++ Program to find the modular inverse using Fermat's Little Theorem + 
modular_inverse_simple.cppSimple implementation of modular multiplicative inverse + 
n_bonacci.cppImplementation of the N-bonacci series + 
n_choose_r.cppCombinations n choose r function implementation + 
ncr_modulo_p.cppThis program aims at calculating nCr modulo p + 
number_of_positive_divisors.cppC++ Program to calculate the number of positive divisors + 
perimeter.cppImplementations for the perimeter of various shapes + 
power_for_huge_numbers.cppCompute powers of large numbers + 
power_of_two.cppImplementation to check whether a number is a power of 2 or not + 
prime_factorization.cppPrime factorization of positive integers + 
prime_numbers.cppGet list of prime numbers + 
primes_up_to_billion.cppCompute prime numbers upto 1 billion + 
quadratic_equations_complex_numbers.cppCalculate quadratic equation with complex roots, i.e. b^2 - 4ac < 0 + 
realtime_stats.cppCompute statistics for data entered in rreal-time + 
sieve_of_eratosthenes.cppPrime Numbers using Sieve of Eratosthenes + 
sqrt_double.cppCalculate the square root of any positive real number in \(O(\log N)\) time, with precision fixed using bisection method of root-finding - 
string_fibonacci.cppThis Programme returns the Nth fibonacci as a string - 
sum_of_binomial_coefficient.cppAlgorithm to find sum of binomial coefficients of a given positive integer - 
sum_of_digits.cppA C++ Program to find the Sum of Digits of input integer - 
vector_cross_product.cppCalculates the Cross Product and the magnitude of two mathematical 3D vectors - 
volume.cppImplmentations for the volume of various 3D shapes + 
string_fibonacci.cppThis Programme returns the Nth fibonacci as a string + 
sum_of_binomial_coefficient.cppAlgorithm to find sum of binomial coefficients of a given positive integer + 
sum_of_digits.cppA C++ Program to find the Sum of Digits of input integer + 
vector_cross_product.cppCalculates the Cross Product and the magnitude of two mathematical 3D vectors + 
volume.cppImplmentations for the volume of various 3D shapes  
numerical_methods  
babylonian_method.cppA babylonian method (BM) is an algorithm that computes the square root  
bisection_method.cppSolve the equation \(f(x)=0\) using bisection method diff --git a/globals_func_m.html b/globals_func_m.html index 253a2619a..01602fa0f 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -116,7 +116,7 @@ $(function(){initNavTree('globals_func_m.html','',''); });
Here is a list of all documented functions with links to the documentation:

- m -