All Exams Test series for 1 year @ ₹349 only
Question

Given two sequences X and Y :

\(X = \langle a, b, c, b, d, a, b \rangle\)

\(Y = \langle b, d, c, a, b, a \rangle\).

The longest common subsequence of X and Y is :

This question was previously asked in
UGC NET 2015 Paper 1 Question Paper (27-Dec-2015)
The correct answer is

\(\langle b, c, b, a \rangle\)

The LCS table for these two sequences gives a maximum length of 4, so any length-3 choice cannot be the longest.

b, c, b, a is a subsequence of X (b at 2, c at 3, b at 4, a at 6) and of Y (b at 1, c at 3, b at 5, a at 6).

b, c, a, a is not a subsequence of X because X has only one a after its c that can be followed by another a (positions 6 then none).

Hence, \(\langle b, c, b, a \rangle\).

Was this answer helpful?

Similar Questions

  1. Consider the problem of a chain <A1, A2, A3> of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5 and 5 × 50 respectively. There are two different ways of parenthesization : (i) ((A1 A2)A3) and (ii) (A1(A2 A3)). Computing the product according to the first parenthesization is ________ times faster in comparison to the second parenthesization.

  2. Let \(n = 4\) and \((a_{1}, a_{2}, a_{3}, a_{4}) = (\text{do, if, int, while})\). Let \(p(1:4) = \left(\frac{3}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}\right)\) and \(q(1:4) = \left(\frac{2}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}, \frac{1}{8}\right)\) where p(i) and q(i) denotes the probability with which we search \(a_{i}\) and the identifier x being searched satisfy \(a_{i} \lt x \lt a_{i+1}\) respectively. The optimal search tree is given by :

  3. The travelling salesman problem can be solved in :

  4. Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.

    (A) Define the base case when the capacity is zero (0) or no items are left to consider

    (B) Compute the maximum value that can be obtained using items up to the i-th item and a knapsack capacity of 0

    (C) Identify subproblems and their dependencies based on items weights and values

    (D) Initialize a table to store results of subproblems

    (E) Iterate through each item and each possible Capacity to fill the table

    Choose the correct answer from the options given below :

  5. A triangulation of a polygon is a set of T chords that divide the polygon into disjoint triangles. Every triangulation of n-vertex convex polygon has _____ chords and divides the polygon into _____ triangles.

  6. The minimum number of scalar multiplication required, for parenthesization of a matrix-chain product whose sequence of dimensions for four matrices is <5, 10, 3, 12, 5> is


Important Questions from Dynamic Programming

  1. Consider a table $T$, where the elements $T[i][j], 0 \le i,j \le n$, represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:

    $T[0][k] = T[k][0] = 1$ for $k = 0,1,2, \dots, n$
    $T[i][j] = 2T[i - 1][j] + 3T[i][j - 1]$ for $1 \le i,j \le n$

    Consider the following two algorithms to compute entries of $T$. Assume that for both the algorithms, for all $0 \le i,j \le n$, $T[i][j]$ has been initialized to 1.

    Algorithm $B_1$:
    For $i = 1, 2, \dots, n$
    For $j = 1, 2, \dots, n$
    $T[i][j] = 2T[i - 1][j] + 3T[i][j - 1]$

    Algorithm $B_2$:
    For $s = 2, 3, \dots, 2n$
    For $i = 1, 2, \dots, n$
    For $j = 1, 2, \dots, n$
    If ($i + j == s$)
    $T[i][j] = 2T[i - 1][j] + 3T[i][j - 1]$

    Algorithm $B_k, k \in \{1,2\}$ is said to be correct if and only if it calculates the correct values of $T[i][j]$, for all $0 \le i,j \le n$, (as per the recursive formulation) at the end of the execution of the algorithm $B_k$.

    Which one of the following statements is true?
  2. Consider the problem of a chain <A1, A2, A3> of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5 and 5 × 50 respectively. There are two different ways of parenthesization : (i) ((A1 A2)A3) and (ii) (A1(A2 A3)). Computing the product according to the first parenthesization is ________ times faster in comparison to the second parenthesization.

  3. Let \(n = 4\) and \((a_{1}, a_{2}, a_{3}, a_{4}) = (\text{do, if, int, while})\). Let \(p(1:4) = \left(\frac{3}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}\right)\) and \(q(1:4) = \left(\frac{2}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}, \frac{1}{8}\right)\) where p(i) and q(i) denotes the probability with which we search \(a_{i}\) and the identifier x being searched satisfy \(a_{i} \lt x \lt a_{i+1}\) respectively. The optimal search tree is given by :

  4. The travelling salesman problem can be solved in :

  5. Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.

    (A) Define the base case when the capacity is zero (0) or no items are left to consider

    (B) Compute the maximum value that can be obtained using items up to the i-th item and a knapsack capacity of 0

    (C) Identify subproblems and their dependencies based on items weights and values

    (D) Initialize a table to store results of subproblems

    (E) Iterate through each item and each possible Capacity to fill the table

    Choose the correct answer from the options given below :

Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) 2026 Mock Test Series
796 Tests 2 Tests Free
214 Attempts
4.4(46)
English
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App