Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Per the lecture, dynamic programming applies to …

Per the lecture, dynamic programming applies to problems that have

Aoptimal substructure AND overlapping sub-problems
Bneither property; DP works on every problem
Cthe greedy-choice property and a sorted input
Dnon-deterministic finite automata in the recurrence
Answer & Solution
Correct answer: A. optimal substructure AND overlapping sub-problems
Both properties are needed. Optimal substructure: the best whole solution is built from best sub-problem solutions. Overlapping sub-problems: the same sub-problem repeats in naive recursion, which is what makes memoisation pay off. Without overlap, plain recursion (or D&C) suffices; without optimal substructure, neither DP nor greedy work.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions