Skip to content

Commit 8a683d2

Browse files
doc: add defintion of memoisation as well as rewrite brief
1 parent 0cbbf30 commit 8a683d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

math/factorial_memoization.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/**
22
* @file
3-
* @brief [Factorial calculation using recursion and memoization (dynamic programming)](https://en.wikipedia.org/wiki/Factorial)
3+
* @brief [Factorial](https://en.wikipedia.org/wiki/Factorial) calculation using recursion and [memoization](https://en.wikipedia.org/wiki/Memoization)
44
* @details
55
* This program computes the factorial of a non-negative integer using recursion
66
* with memoization (top-down dynamic programming). It stores intermediate results
77
* to avoid redundant calculations for improved efficiency.
88
*
9+
* Memoization is a form of caching where the result to an expensive function call
10+
* is stored and returned.
911
* Example:
1012
* Input: n = 5
1113
* Output: 120

0 commit comments

Comments
 (0)