Skip to content

Commit e963491

Browse files
fix: wrap factorial functions under math namespace
1 parent fb3f95e commit e963491

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

math/factorial_memoization.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727

2828
/// Array to store computed factorials for memoization
2929
std::array<uint64_t, 1000> memo{0};
30+
#include <iostream> /// for IO operations
31+
32+
/**
33+
* @namespace math
34+
* @brief Math algorithms
35+
*/
36+
namespace math {
3037

3138
/**
3239
* @brief Computes the factorial of a non-negative integer using recursion and memoization.
@@ -40,6 +47,7 @@ uint64_t fact_recursion(uint64_t n) {
4047
return memo[n];
4148
}
4249

50+
} // namespace math
4351
/**
4452
* @brief Self-test implementations for the fact_recursion function.
4553
* @returns void

0 commit comments

Comments
 (0)