You might think: "Just sort by value and grab items until the bag is full." Try it on this example: Items: (, ), (, ), (, ), (, ).
Capacity . Greedy by value picks the most valuable item first: (, ). Remaining capacity is 2. The only item that fits is (, ). Total value: .
But taking items (, ) and (, ) gives with total weight . The greedy approach misses this better combination. You need DP to explore all possibilities efficiently.