Friday, 28 February 2014

Recursion is a very useful and often necessary tool for solving a variety of problems.  In my personal use I probably use it more for DFS and floodfill than anything else. It is particularly useful for mapping problems that can't be solved using a purely dynamic programming approach.  Although a lot of problems that can be solved well with recursion can be solved equally well (and without concern of stack overflow) with looping, recursion is invaluable when looping isn't an option.  In light of our recent assignment, recursion is necessary to writing a regex interpreter, especially if lookahead/behind is being incorporated (which I suppose it isn't in the assignment).  It's also really nice to compress a complex algorithm to a few lines of a recursive function.  Analyzing the time efficiency of that function isn't always nice though.

No comments:

Post a Comment