GATE Computer ScienceModerateNIELIT Scientist B
What is the length of a longest common subsequence of PROGRAMMING and ALGORITHM?
- A. 4
- B. 2
- C. 3
- D. 5
Correct answer: C. 3
The LCS table for the two strings gives length 3.
More Algorithms questions
- A weighted undirected graph on vertices 0–5 has edges (0,1,4), (0,2,3), (1,2,1), (1,3,2), (2,3,4), (3,4,2), (4,5,6), (3,5,7), (2,5,8)…
- A DAG on vertices 0–5 has edges 0→2, 1→2, 2→3, 2→4, 3→5 and 4→5. How many distinct topological orderings does it have?
- With unit cost for insertion, deletion and substitution, what is the edit distance between INTENTION and EXECUTION?
- Six matrices have dimensions 30×35, 35×15, 15×5, 5×10, 10×20 and 20×25 in a chain. What is the minimum number of scalar multiplications to…
- Quicksort uses the last element of each sub-array as pivot and compares every other element of the sub-array with it once. On [4, 7, 1, 9…
- Consider T(n) = T(n/2) + T(n/3) + T(n/6) + n with T(1) = 1. Which bound is tight?