This is a simple implementation of a standard algorithm & is a classic example of Tail Recursion - the form of recursion which is redundant & can be replaced by a simpler, more efficient iterative equivalent (as Pradeep has done in his article of the same program - click here)

Regards,
Rajiv Iyer

PS: Tail Recursion's classic trademark identification signature is that the recursive calls are usually the last statements within the recursive function's body.