avp26/u11/knapsack.py
2026-12-04 20:13:42 +00:00

19 lines
374 B
Python

def maximum_value(maximum_weight, items):
hodnota, vec = maximum_value_with_items(maximum_weight, items)
return hodnota
def maximum_value_with_items(maximum_weight, items):
dv = []
for _ in range(maximum_weight):
dv.append((0, []))
for item in items:
vaha = item["veight"]
hodnota = ["value"]
return dv[maximum_weight]