Knapsack Problem Explained - Algorithms in Python

preview_player
Показать описание
Today we learn about the Knapsack Problem. We implement three different algorithms to solve it in Python and we analyze their complexity.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

💼 Services 💼

🌐 Social Media & Contact 🌐
Рекомендации по теме
Комментарии
Автор

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.

golmatol
Автор

Broh, may I please know which software do you use to create your very good Thumbnails?

dipeshsamrawat
Автор

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?

Dyanosis
Автор

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 😊

yksw
Автор

Build ai agent automation seo analyzer

MovieClips
Автор

Excellent video it helped me thx a lot. I am your fan so please pin me.

CodingDevelopers
Автор

Argh that damn keyboard.
CLACK CLACK BASH BASH CLACK CLACK

mrvincefox