Wish you had drawn out an actual table (perhaps with just 3-4 items) and run through it manually to show the values are being updated. Will need to watch some other knapsack related video now to really understand that last algorithm.
Your dynamic algo is definitely not efficient if you're looping over i and w and not just starting from 1 instead of 0. Why start from a number and be forced to initialized and ignore it if you could start from a number that matters? Also, seems a little weird that you're loops from 0 to 15 but looking at the previous item and previous DP. Wouldn't it make just as much sense to loop from 0 to 14 and get the same result?
It's actually pretty easy to solve: search for the item with the largest value and smallest weight. Then repeat until the sack is filled. This is the method I have used at industrial scale and it performs outstandingly. Performance is the highest value in the industry, because time is money 😊
@@rakotoarilantonirinadesire4110 He computed a value and ordered it accordingly to it. However, on large data fields, division is more expensive than multiplication, and sorting prohibitive, if not impossible. Imagine a large user database and the intent to collect a number of members with similar attributes. With my method, I do a record scan and remember simply the records, in a small array, which match the criteria, over the whole set of records. By the time I would make the division or multiplication, I have the values already placed, and by the time the second iteration of a sorting algorithm would start, I have scanned all data.
Wish you had drawn out an actual table (perhaps with just 3-4 items) and run through it manually to show the values are being updated. Will need to watch some other knapsack related video now to really understand that last algorithm.
i got lost on the last one too, still interesting.
Broh, may I please know which software do you use to create your very good Thumbnails?
Your dynamic algo is definitely not efficient if you're looping over i and w and not just starting from 1 instead of 0. Why start from a number and be forced to initialized and ignore it if you could start from a number that matters? Also, seems a little weird that you're loops from 0 to 15 but looking at the previous item and previous DP. Wouldn't it make just as much sense to loop from 0 to 14 and get the same result?
Build ai agent automation seo analyzer
good idea
It's actually pretty easy to solve: search for the item with the largest value and smallest weight. Then repeat until the sack is filled.
This is the method I have used at industrial scale and it performs outstandingly. Performance is the highest value in the industry, because time is money 😊
I think he has done it with the second solution. He was talking about ratio between value and weight.
@@rakotoarilantonirinadesire4110 He computed a value and ordered it accordingly to it. However, on large data fields, division is more expensive than multiplication, and sorting prohibitive, if not impossible. Imagine a large user database and the intent to collect a number of members with similar attributes. With my method, I do a record scan and remember simply the records, in a small array, which match the criteria, over the whole set of records. By the time I would make the division or multiplication, I have the values already placed, and by the time the second iteration of a sorting algorithm would start, I have scanned all data.
Your solution is "good enough" but doesn't return the actual best combination. There's no simple greedy solution to this problem.
@@gsscala The industry wants the fastest and still best solution for the problem. In case of doubt, speed prevails.
Excellent video it helped me thx a lot. I am your fan so please pin me.
Thx_.
It’s just Tetris. Debate
Argh that damn keyboard.
CLACK CLACK BASH BASH CLACK CLACK