GATEverse
← GATE CSE 2008

Q80

MCQ2 marks, −0.5

The subset-sum problem is defined as follows. Given a set of nn positive integers, S={a1,a2,a3,…,an}S = \{ a_1, a_2, a_3, \dots , a_n \}, and positive integer WW, is there a subset of SS whose elements sum to WW? A dynamic program for solving this problem uses a 2-dimensional\text{2-dimensional} Boolean array, XX, with nn rows and W+1W+1 columns. X[i,j],1≤i≤n,0≤j≤WX[i, j], 1 \leq i \leq n, 0 \leq j \leq W, is TRUE, if and only if there is a subset of {a1,a2,…,ai}\{a_1, a_2, \dots, a_i\} whose elements sum to jj. Which of the following is valid for 2≤i≤n2 \leq i \leq n, and ai≤j≤Wa_i \leq j \leq W?

Sign in to save attempts.

Loading…