From 87d46d78d1c9284303716f00aeed47f5ba393411 Mon Sep 17 00:00:00 2001 From: halderjoydeep Date: Sun, 7 Oct 2018 22:52:00 +0530 Subject: [PATCH] knapsack.py : Add Knapsack Problem Greedy Approach to solve the Knapsack Problem closes https://github.com/NITSkmOS/Algorithms/issues/305 --- knapsack_problem/Python/knapsack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knapsack_problem/Python/knapsack.py b/knapsack_problem/Python/knapsack.py index a55c9708..71fd8137 100644 --- a/knapsack_problem/Python/knapsack.py +++ b/knapsack_problem/Python/knapsack.py @@ -15,7 +15,7 @@ def knapsack(profit, weight, capacity): :return: maximum profit and the fraction of items """ - # array of profit/weight ratio + # ratio is array of profit/weight ratio ratio = [v / w for v, w in zip(profit, weight)] # a list of (0, 1, ..., n-1)