I recently began to understand what pseudo polynomial means thanks to this post. However, a burning question of mine is why does the knapsack problem when used with dynamic Programming has a runtime of and not
. Where n is number of items that are being considered for the knapsack and
which is the number of bits needed to encode W and
is number of possible states(values) given x bits. Considering that the formal definition of time complexity defines the size of a problem as
The size of the input to a problem is the number of bits required to write out that input.
Since number of bits for the weight is not fixed but rather variable, there are at most total number of bits for all the possible values from 0 to W times the value n or
. With that being said why is the runtime for the knapsack when paired with dynamic programming has a runtime of
and not
. I know that
but time complexity refers to size of the input as number of bits. What assumptions am I making, or what piece of knowledge am I missing that would rectify the disconnect.