Computer Science EngineeringVery hard

The 0/1 knapsack problem with n items and capacity W is solved by dynamic programming in time

  1. A. O(n + W)
  2. B. O(W^n)
  3. C. O(nW)
  4. D. O(n log W)

Correct answer: C. O(nW)

The table has n*W entries each computed in constant time, which is pseudo-polynomial.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic