Fractional Knapsack Problem Using Greedy Approach
Problem : Let P[1….n] and W[1….n] be the sets of profits and
corresponding weights of the elements in the given knapsack problem.
Let c be the maximum weight that the given knapsack can hold.
Let X[1….n] be the set of fractions of elements placed in the knapsack.
Initially all the elements of set X are set to zero,
as the knapsack is empty.
Statement of the knapsack problem : Maximize ∑i=1n (PiXi)
subject to constraint ∑i=1n (WiXi) <=c.