Sunday, 13 October 2013
Recursion
It is a deceptively simple process, create a method that calls itself, breaking a bigger problem into identical, smaller problems, until the problem becomes trivially easy to solve. While the ending case can usually be easily envisioned, and the starting case given, it is therefore in the middle that is the hardest part of a recursive program, the few lines of code that divide the problem into smaller problems, and calls upon itself accordingly. Therefore, though it could be confusing to follow, recursive programs are simple to understand due to only requiring the few lines of code, each a reference to itself or the terminating case.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment