Time Left - 15:00 mins
GATE 2024 Algorithms Foundation Quiz 18
Attempt now to get your rank among 60 students!
Question 1
Consider the following recursive function which is used to evaluate the longest common subsequence of two strings X and Y having length m and n respectively. Find the missing statement in the code :
int lcs( char *X, char *Y, int m, int n )
{
if (m == 0 || n == 0)
return 0;
if (X[m-1] == Y[n-1])
return 1 + lcs(X, Y, m-1, n-1);
else
return _________
}
int lcs( char *X, char *Y, int m, int n )
{
if (m == 0 || n == 0)
return 0;
if (X[m-1] == Y[n-1])
return 1 + lcs(X, Y, m-1, n-1);
else
return _________
}
Question 2
Consider the following sequence of elements.
Find the maximum sum of contiguous subsequence of a list S.
Find the maximum sum of contiguous subsequence of a list S.
Question 3
LCS(m, n) : It is the problem to find the length of longest substring present in both of given strings x and y of length m and n respectively.
Consider the following code:
Time complexity of this code is O(ma*nb) and space complexity is O(mc*nd).
compute 2*a + b - c/2 + 6d.
Question 4
Consider the following direct graph:
What is the adjacently matrix after Floyd’s algorithm applied on the above graph to find all pairs shortest paths?
Question 5
In a 0/1 Knapsack Problem, what is the amount of time taken to create the memory table and determine the optimal solution respectively, for K number of objects and T as the capacity of Knapsack?
- 60 attempts
- 0 upvotes
- 1 comment
Tags :
GATE & PSU CSAlgorithmsMar 30GATE & PSU CS