Q. In a dynamic programming solution for the Longest Common Subsequence (LCS), what does the DP table represent?
-
A.
The length of the LCS
-
B.
The characters of the LCS
-
C.
The indices of the LCS
-
D.
The number of subsequences
Solution
The DP table in LCS represents the length of the longest common subsequence between two strings.
Correct Answer:
A
— The length of the LCS
Learn More →
Q. In dynamic programming, what is the purpose of the 'base case'?
-
A.
To initialize the DP table
-
B.
To define the recursive function
-
C.
To handle edge cases
-
D.
To optimize the algorithm
Solution
The base case is used to initialize the DP table and provide starting values for the recursive relations.
Correct Answer:
A
— To initialize the DP table
Learn More →
Q. Which of the following dynamic programming problems can be solved in polynomial time?
-
A.
Traveling Salesman Problem
-
B.
Longest Increasing Subsequence
-
C.
Hamiltonian Path
-
D.
Graph Coloring
Solution
The Longest Increasing Subsequence problem can be solved in polynomial time using dynamic programming.
Correct Answer:
B
— Longest Increasing Subsequence
Learn More →
Showing 1 to 3 of 3 (1 Pages)