Sunday, 13 October 2013

Recursion

Recursion is where the solution for a problem involves calling on the solution many times to solve the problem. A recursive solution uses a base case, where if the solution satisfies the base case, the recursive aspect of the solution will not be called into play, and the program will exit. However, if the base case is not satisfied , the recursive loop will be called and the process will repeat again, where the base case is checked.

Recursion can help when you have to navigate and search through lists, lists of lists , trees and those types of data types. With large recursive processes, where the solution has to be called many times, recursion can be less efficient however.

No comments:

Post a Comment