2

I'm asking about the question described here: Knapsack Problem with exact required item number constraint

Can't we iterate over $\binom{n}{L}$ options (which is polynomial), and for each option check if the constraints are met?

yong
  • 41
  • 4

1 Answers1

2

$L$ is given as part of the input, and can be e.g., $n/2$, where $n$ is the number of items. Then, iterating over ${n\choose L}={n\choose \frac{n}2}$ is exponential.

Note that it doesn't matter whether $L$ is given in unary or binary, since $n$ is given in unary (as a list of the different items).

Shaull
  • 17,814
  • 1
  • 41
  • 67