Skip to main content

Fractional Knapsack

Learn Fractional Knapsack (Greedy Algorithms, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Filling a Knapsack When Items CAN Be Split Given items with weight and value, and a knapsack capacity, maximize total value - items can be taken in FRACTIONS (unlike 0/1 Knapsack). The greedy strategy: always take as much as possible of the item with the HIGHEST value-per-weight ratio first.

More lessons in Greedy Algorithms