Loading video...
QuickNotes™ 
Recursion
Recursion: Is a method of repeating a task without using a looping statement, which is accomplished with a call to the function itself with a value different than the one used before.
Advantages: Short , Simple to implement, Elegant solutions using divide & conquer algorithms
Disadvantages: Recursion requires more memory, More processor power, More Time, Sometimes more complex algorithms are required
Recursive functions: Require 2 steps; base case and recursive step.
Example: To implement N! in Java using recursion:
public int factorial(int n) {
if (n == 0)
return 1;
else
return n * factorial(n - 1); //tail recursion
}
Discussion 
Please login to ask a question and view discussion.













