File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 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) {
2121}
2222
2323/**
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.
2532 * @param i
2633 * @return
2734 */
You can’t perform that action at this time.
0 commit comments