Challenge: Fractional Knapsack Problem

Given weights and values of n items, put these in a knapsack of capacity W.

Problem Statement

Implement a function that puts items in a knapsack of capacity W to get the maximum total value in the knapsack, given weights and values of n items. This problem is also known as the continuous knapsack problem.

Note: In the 0-1 Knapsack problem, we are not allowed to break items. We either take the whole item or do not take it at all. However, here we can split the items.

Input

Items as (value,weight)(value, weight) pairs and Knapsack Capacity WW.

Output

Maximum Possible Value

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.