All mock tests are FREE till 31 December — register to save your progress

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 step(s) is/are common to both dynamic programming and greedy algorithms? S

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. Only 1 S

Explanation

Both start by characterizing the structure of an optimal solution (optimal substructure). Computing values bottom-up is specific to dynamic programming.

More Data Structures and Algorithms questions