Question DSA-DP-0069
HardWhat is the time complexity of the 0/1 knapsack DP with n items and capacity W, and why is it not polynomial?
- A.
O(nW); W is a value, so the time is exponential in the number of bits used to write W
- B.
O(2ⁿ); it tries every subset
- C.
Sign up free to see the answer and a step-by-step explanation.