Types of recursion
There are several different recursion types and terms. These include:
Direct recursion: This is typified by the factorial implementation where the methods call itself.
Mutual recursion: This happens where one method, say method A, calls another method B, which then calls method A. This involves two or more methods that eventually create a circular call sequence.
Multi-recursion: Multiple recursive calls are made in the method.
Head recursion: The recursive call is made at the beginning of the method.
Tail recursion: The recursive call is the last statement.
Direct recursion is the most common form of recursion. Head and tail recursion are specialized terms for direct and mutual recursion.
Mutual recursion is not as common as other forms of recursion. However, it can be quite useful in the implementations of recursive descent parsers. The reader is referred to http://en.wikipedia.org/wiki/Recursive_descent_parser for details on how to use mutual recursion with a recursive...