How can I best study a problem to determine whether recursion can/should be used?

Posted by user10326 on Programmers See other posts from Programmers or by user10326
Published on 2011-10-28T09:18:24Z Indexed on 2011/11/16 18:13 UTC
Read the original article Hit count: 360

Filed under:
|

In some cases, I fail to see that a problem could be solved by the divide and conquer method. To give a specific example, when studying the find max sub-array problem, my first approach is to brute force it by using a double loop to find the max subarray. When I saw the solution using the divide and conquer approach which is recursion-based, I understood it but ok. From my side, though, when I first read the problem statement, I did not think that recursion is applicable.

When studying a problem, is there any technique or trick to see that a recursion based (i.e. divide and conquer) approach can be used or not?

© Programmers or respective owner

Related posts about algorithms

Related posts about recursion