Skip to content

Commit e6e3aba

Browse files
committed
Added Logic
1 parent 4bb9f32 commit e6e3aba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/com/sanket/recursion/Factorial.java

+8-1
Original file line numberDiff line numberDiff 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
*/

0 commit comments

Comments
 (0)