mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-01 00:41:09 +00:00
Added test case
Added a test case check knapsack.py
This commit is contained in:
parent
9faaebcc80
commit
2f22ea1acd
|
@ -12,3 +12,13 @@ def knapsack(W, wt, val, n):
|
|||
dp[i][w] = dp[i-1][w]
|
||||
|
||||
return dp[n][w]
|
||||
if name == "__main__":
|
||||
val = [3,2,4,4]
|
||||
wt = [4,3,2,3]
|
||||
W = 6
|
||||
n = 4
|
||||
'''
|
||||
Should give 8
|
||||
'''
|
||||
print(knapsack(W,wt,val,n))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user