divide and conquer method vs dynamic programming