Node:Recursion summary, Next:Questions 21, Previous:Controlled recursion with data structures, Up:Recursion
Recursion can be a powerful programming technique, especially when dealing with mathematical functions such as factorialisation that lend themselves naturally to recursion, or with self-similar data structures. There is a major disadvantage to recursion, however, and that is the amount of memory required to make it work. Do not forget that the program stack grows each time a function call is made. If a function calls itself too many times, your program will run out of memory and crash. Recursive programming can also be difficult; runaway recursion is a common error. Therefore, be judicious in your use of recursion.