Difference between Divide and Conquer Algo and Dynamic Programming

后端 未结 9 1944
一个人的身影
一个人的身影 2020-12-12 08:41

What is the difference between Divide and Conquer Algorithms and Dynamic Programming Algorithms? How are the two terms different? I do not understand the difference between

9条回答
  •  渐次进展
    2020-12-12 09:26

    Divide and Conquer

    • In this problem is solved in following three steps: 1. Divide - Dividing into number of sub-problems 2. Conquer - Conquering by solving sub-problems recursively 3. Combine - Combining sub-problem solutions to get original problem's solution
    • Recursive approach
    • Top Down technique
    • Example: Merge Sort

    Dynamic Programming

    • In this the problem is solved in following steps: 1. Defining structure of optimal solution 2. Defines value of optimal solutions repeatedly. 3. Obtaining values of optimal solution in bottom-up fashion 4. Getting final optimal solution from obtained values
    • Non-Recursive
    • Bottom Up Technique
    • Example: Strassen's Matrix Multiplication

提交回复
热议问题