Which items go in the knapsack?
You know how many points the bag can hold. Find the items that fit and earn that score.
Each row adds one item. Under each capacity is the best score available so far.
If the score above is equal, skip the item. If it is smaller, take the item.
With the table ready, visit each item once. The result uses n flags.