The longest common subsequence of {1,2,3,2,4,1,2} and {2,4,3,1,2,1} is
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 2,3,2,1
Explanation
2,3,2,1 appears in order in both sequences (1,2,3,2,4,1,2 and 2,4,3,1,2,1) and the LCS length is 4. 2,1,2,3 and 1,3,2,1 are not subsequences of the second sequence, and 2,3,1,2,1 is not a subsequence of the first.More Data Structures and Algorithms questions
- Match List I (Hashing Collision Handling Method) with List II (Strategy)List I List II A. Chaining I. Check next slot B. Linear Probing II.…
- Maintaining a graph in memory by means of its adjacency matrix is known as
- Match List I with List IIList I List II A. Circular Queue I. Print Queue B. Priority Queue II. CPU Scheduling C. Double Ended Queue III. Di…
- The tight asymptotic bound for the recurrence T(n) = 2T(n/4) + √n is
- When developing a dynamic programming algorithm, the sequence of steps followed is: A. Construct an optimal solution from computed informat…
- The correct sequence of constructing a Huffman tree is A. Repeat until root formed B. Create leaf nodes C. Build priority queue D. Combine…