Possible Duplicate:
Examples of Recursive functions
I have been trying to research recursion in programming as a concept (though I am specifically studying Java) and this is what I got to understand the best:
In real life for example, recursion is when we put two mirrors infront of each other and the images produced between them are recursive.
But I don’t get this algorithm in programming?
Can someone give me a simplified example to understand recursion ?
Basically, a function is recursive when
As an example, to calculate an factorial: