Intermediate Data Structures & Algorithms
Q67 / 100

What is the difference between greedy algorithms and dynamic programming?

Correct! Well done.

Incorrect.

The correct answer is B) Greedy makes locally optimal choices without reconsidering; DP considers all subproblems and builds the globally optimal solution

B

Correct Answer

Greedy makes locally optimal choices without reconsidering; DP considers all subproblems and builds the globally optimal solution

Explanation

Greedy works when the greedy choice property holds (local optimum leads to global). DP is needed when subproblem solutions overlap and greedy fails (e.g., 0/1 knapsack).

Progress
67/100