Fractional Knapsack — Greedy by Density

Sort by value/weight, take whole items, slice the last to fill the bag

Items (value/weight)

Run

Speed

Result

Capacity W
50
Remaining
Fractional value
0/1 value

Log

Knapsack fill

taken whole sliced fraction active / considering rejected (no room)

Items sorted by density

Explanation

Load items and press Run all to sort by density (value/weight), then greedily fill the bag — taking whole items and slicing the last one to top off the capacity exactly.