File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,14 @@ public static void main(String[] args) {
21
21
}
22
22
23
23
/**
24
- *
24
+ * Steps:
25
+ * 1. The base case returns a value without making any subsequent recursive calls.
26
+ * It does this for one or more special input values for which the function can be evaluated without recursion.
27
+ * For factorial(), the base case is n = 1.
28
+ * 2. The reduction step is the central part of a recursive function.
29
+ * It relates the value of the function at one (or more) input values to the value of the function at one (or more) other input values.
30
+ * Furthermore, the sequence of input values values must converge to the base case. For factorial(),
31
+ * the value of n decreases by 1 for each call, so the sequence of input values converges to the base case.
25
32
* @param i
26
33
* @return
27
34
*/
You can’t perform that action at this time.
0 commit comments