GATE Computer ScienceHardGATE CS (PYQ pattern)
Which of the following statements about the 0/1 knapsack problem is/are correct? I. The O(nW) dynamic programme is polynomial in n and in the numeric value W, but not in the number of bits needed to write W. II. If W is encoded in unary, the O(nW) algorithm is polynomial in the input size. III. The fractional knapsack problem is NP-hard. IV. The decision version of 0/1 knapsack is NP-complete.
- A. I and III only
- B. II and IV only
- C. I, II, III and IV
- D. I, II and IV only
Correct answer: D. I, II and IV only
I and II describe pseudo-polynomial time precisely (the running time is polynomial in the numeric value). IV is the classical NP-completeness result. III is false: fractional knapsack is solved greedily by value/weight ratio in O(n log n).
More Algorithms questions
- Six tasks have (processing time, deadline): (3,6), (2,8), (4,9), (1,5), (5,15), (2,10). They run one after another on a single machine…
- In how many ways can 12 be written as an ordered sum of parts from {1, 2, 3} such that no two adjacent parts are equal (e.g. 1+2+1+3+… is…
- Which of the following statements about dynamic programming problems is/are correct? I. The LCS of two strings can be computed in O(mn)…
- Ten houses stand in a CIRCLE with values 6, 2, 9, 4, 3, 8, 1, 7, 5, 10 (the first and last houses are neighbours). No two neighbouring…
- Among all full parenthesisations of the product A₁A₂A₃A₄A₅A₆A₇, how many contain the product (A₃A₄) as one of their sub-products?
- X = ABCBDAB and Y = BDCABA have longest common subsequences of length 4. How many DIFFERENT strings are shortest common supersequences of…