1
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a1 ,a2 ,a3 ,…,an} and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array X, with n rows and W+1 columns. X[i, j], 1 <= i <= n, 0 <= j <= W, is TRUE if and only if there is a subset of {a1 ,a2 ,…,ai} whose elements sum to j.

Which entry of the array X, if TRUE, implies that there is a subset whose elements sum to W?
A
X[1, W]
B
X[n, 0]
C
X[n, W]
D
X[n-1, n]
2
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a1 ,a2 ,a3 ,…,an} and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array X, with n rows and W+1 columns. X[i, j], 1 <= i <= n, 0 <= j <= W, is TRUE if and only if there is a subset of {a1 ,a2 ,…,ai} whose elements sum to j.
Which of the following is valid for 2 <= i <= n and ai <= j <= W?
A
X[i, j] = X[i – 1, j] V X[i, j -ai]
B
X[i, j] = X[i – 1, j] V X[i – 1, j – ai]
C
X[i, j] = X[i – 1, j] V X[i, j – ai]
D
X[i, j] = X[i – 1, j] V X[i -1, j – ai]
3
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
GATE CSE 2008 Algorithms - Greedy Method Question 25 English Dijkstra's single source shortest path algorithm when run from vertex a in the above graph, computes the correct shortest path distance to
A
only vertex a
B
only vertices a,e,f,g,h
C
only vertices a,b,c,d
D
all the vertices
4
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then
A
$${\rm{T(n) < = 2T(n/5) + n}}$$
B
$$T\left( n \right){\rm{ }} < = {\rm{ }}T\left( {n/5} \right){\rm{ }} + {\rm{ }}T\left( {4n/5} \right){\rm{ }} + {\rm{ }}n$$
C
$$T\left( n \right){\rm{ }} < = {\rm{ }}2T\left( {4n/5} \right){\rm{ }} + {\rm{ }}n$$
D
$$T\left( n \right){\rm{ }} < = {\rm{ }}2T\left( {n/2} \right){\rm{ }} + {\rm{ }}n$$
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12