Knapsack Problem (Fractional )

Опубликовано: 16 Март 2026
на канале: Play With Coding
274
24

Material - https://github.com/sravansai04/data-s...

The fractional knapsack problem is solved using the greedy method in the following steps-
Step-01:
For each item, compute its value/weight ratio.
Step-02:
Arrange all the items in decreasing order of their value/weight ratio.
Step-03:
Start putting the items into the knapsack beginning from the item with the highest ratio.
Put as many items as you can into the knapsack.