Module knaptime::dpsliding

source ·
Expand description

DP Knapsack with sliding window optimization

Functions

  • A sliding window dp knapsack solution. Useful when capacity is large and your max weight is small. Instead of allocating a large array, just allocate an array of max weight. Then look back and wrap around if needed.