Q20.Marks: +2.0UGC NET Paper 2: Computer Science and Application 26th June 2025 Shift 1
When developing a dynamic programming algorithm, the sequence of steps followed is:
A. Construct an optimal solution from computed information.
B. Recursively define the value of an optimal solution.
C. Characterize the structure of an optimal solution.
D. Compute the value of an optimal solution, typically in a bottom-up fashion.
Choose the correct answer from the options given below:
1.B, C, A, D
2.B, A, C, D
3.C, B, A, D
4.C, B, D, A✓ Correct
Solution
The correct answer is Option 4
Key Points
Dynamic programming is a technique used to solve optimization problems by breaking them into smaller sub-problems and solving each sub-problem only once.
The steps to follow when developing a dynamic programming algorithm involve understanding the structure of the problem, defining the solution recursively, computing the solution, and then constructing the result.
Detailed Explanation
Step 1 - Characterize the structure of an optimal solution: This involves understanding how the solution to the problem can be broken into smaller sub-problems. For example, in the case of the Fibonacci sequence, the nth Fibonacci number depends on the (n-1)th and (n-2)th Fibonacci numbers.
Step 2 - Recursively define the value of an optimal solution: Write a recurrence relation or formula that represents the solution to the problem in terms of its sub-problems.
Step 3 - Compute the value of an optimal solution, typically in a bottom-up fashion: Solve the problem iteratively using a table (array) to store intermediate results. This avoids recalculating the same sub-problem multiple times, which is what makes dynamic programming efficient.
Step 4 - Construct an optimal solution from computed information: Once the value of the optimal solution is computed, use the stored information in the table to reconstruct the actual solution to the problem.
Order of Steps:
Characterize the structure of an optimal solution (Step C).
Recursively define the value of an optimal solution (Step B).
Compute the value of an optimal solution, typically in a bottom-up fashion (Step D).
Construct an optimal solution from computed information (Step A).
Hence, the correct sequence is:C, B, D, A, which corresponds to Option 4.