<P> Most computer programming languages support recursion by allowing a function to call itself within the program text . Some functional programming languages do not define any looping constructs but rely solely on recursion to repeatedly call code . Computability theory proves that these recursive - only languages are Turing complete; they are as computationally powerful as Turing complete imperative languages, meaning they can solve the same kinds of problems as imperative languages even without iterative control structures such as "while" and "for". </P> <P> A common computer programming tactic is to divide a problem into sub-problems of the same type as the original, solve those sub-problems, and combine the results . This is often referred to as the divide - and - conquer method; when combined with a lookup table that stores the results of solving sub-problems (to avoid solving them repeatedly and incurring extra computation time), it can be referred to as dynamic programming or memoization . </P> <P> A recursive function definition has one or more base cases, meaning input (s) for which the function produces a result trivially (without recurring), and one or more recursive cases, meaning input (s) for which the program recurs (calls itself). For example, the factorial function can be defined recursively by the equations 0! = 1 and, for all n> 0, n! = n (n − 1)! . Neither equation by itself constitutes a complete definition; the first is the base case, and the second is the recursive case . Because the base case breaks the chain of recursion, it is sometimes also called the "terminating case". </P> <P> The job of the recursive cases can be seen as breaking down complex inputs into simpler ones . In a properly designed recursive function, with each recursive call, the input problem must be simplified in such a way that eventually the base case must be reached . (Functions that are not intended to terminate under normal circumstances--for example, some system and server processes--are an exception to this .) Neglecting to write a base case, or testing for it incorrectly, can cause an infinite loop . </P>

Write a program for recursion in data structure