UGC-NET Jun 2019 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0065

Consider the following steps: $S_1$: Characterize the structure of an optimal solution $S_2$: Compute the value of an optimal solution in bottom-up fashion Which of the following step(s) is/are common to both dynamic programming and greedy algorithms?
  1. A
    Only $S_1$
  2. B
    Only $S_2$
  3. C
    Both $S_1$ and $S_2$
  4. D
    Neither $S_1$ nor $S_2$

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionBoth paradigms rely on optimal substructure, so step \(S_1\), characterising the structure of an optimal solution, is common to both.Step \(S_2\), computing the value of an optimal solution bottom-up in a table, is specific to dynamic programming. A greedy algorithm makes one locally best choice and then solves the single remaining subproblem, working top-down without tabulating subproblem values.So only \(S_1\) is common.Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com