Summary


Recursion occurs whenever a routine calls itself, directly or indirectly, as part of its processing. One or more base cases are needed to end the recursion; otherwise, the algorithm loops indefinitely - a common problem to watch out for.

A recursive algorithm can always be recoded to use iteration in place of recursion by using a stack to maintain the algorithm’s state, which is essentially what the program is doing anyway. Sometimes, however, an iterative alternative to a recursive algorithm can be found, and such solutions are generally more efficient than their recursive counterparts.




Programming Interviews Exposed. Secrets to Landing Your Next Job
Programming Interviews Exposed: Secrets to Landing Your Next Job, 2nd Edition (Programmer to Programmer)
ISBN: 047012167X
EAN: 2147483647
Year: 2007
Pages: 94

Similar book on Amazon
Cracking the Coding Interview: 150 Programming Questions and Solutions
Cracking the Coding Interview: 150 Programming Questions and Solutions
The Google Resume: How to Prepare for a Career and Land a Job at Apple, Microsoft, Google, or any Top Tech Company
The Google Resume: How to Prepare for a Career and Land a Job at Apple, Microsoft, Google, or any Top Tech Company
Programming Pearls (2nd Edition)
Programming Pearls (2nd Edition)
Algorithms For Interviews
Algorithms For Interviews

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net