Given a Knapsack/Bag with W weight capacity and a list of N items with given vi value and wi weight. Put these items in the knapsack in order to maximise the value of all the placed items without exceeding the limit of the Knapsack.
The problem remains the same but one cannot break the items you can either select it fully ( 1) or don’t select it (0 ).
Example:
value = [1, 4, 5, 7]
weight = [1, 3, 4, 5]
maxWeight = 7
Ans: 9 (weight 3, 4)
----------------------------------------------------------------------------------------------------------------------
Practice this 0/1 knapsack problem on:
Practice on Interviewbit: https://www.interviewbit.com/problems...
Practice on CodingNinjas; https://www.codingninjas.com/codestud...
Practice on GeeksforGeeks: https://practice.geeksforgeeks.org/pr...
----------------------------------------------------------------------------------------------------------------------
Смотрите видео 0/1 Knapsack Problem - Top Down Memoization - Dynamic Programming - DP онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь BarikZone 29 Июль 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 487 раз и оно понравилось 6 людям.