Тёмный

01 Knapsack Problem | Amazon Coding Interview | Dynamic programming | EP5 

JAVAAID - Coding Interview Preparation
Подписаться 37 тыс.
Просмотров 12 тыс.
50% 1

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@pedestrian9287
@pedestrian9287 4 года назад
Finally someone who can clearly breakdown a problem!! Excellent video!!!
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thank you very much for providing your feedback on multiple videos. It really help youtube to find my channel helpful.
@onetechlab8697
@onetechlab8697 4 года назад
Just one word "Awesome". Thanks a lot man.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Thanks for the feedback 😊
@manhoodthinkmanly
@manhoodthinkmanly 2 года назад
what a masterpiece great great explaination- jai kanhaiya lal ki
@aravinddesikamani
@aravinddesikamani 5 лет назад
You are the best! Waiting for your next video!!
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Thanks a lot @Aravind and stay tuned for more.
@rajkumararora7366
@rajkumararora7366 2 года назад
Complexities of solution made simple... Fantastic 👍
@shaiknoor6141
@shaiknoor6141 3 года назад
Amazing explanation . Easy for understand..#AmazingExplainer to Kanaya Gupta
@JavaAidTutorials
@JavaAidTutorials 3 года назад
Glad you liked it!
@sargamagarwal4544
@sargamagarwal4544 3 года назад
Best explanation on RU-vid 🔥🔥
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Hey Every one, If you find this tutorial helpful, please do not forget to like, comment, share and It would be great if you can leave your feedback about the tutorial, as I have put a lot of hard work to make things easy for you. Thanks ..!!
@rajatparab8116
@rajatparab8116 4 года назад
Thank u for the video👍👍 Really liked ur content bhai Happy New Year 😃
@JavaAidTutorials
@JavaAidTutorials 4 года назад
most welcome..:) thank you and wish you the same. If you find our channel helpful, please share with your friends also.
@utpalgaurav14
@utpalgaurav14 4 года назад
Hello Sir, I was thinking of this method, please tell me whether this method will work or not. 1. Take all 'n' inputs and calculate value per unit weight (unitvalue = value/weight) for every item 2. Store unitvalue of every item in an array. 3. Now arrange the unitvalue array in descending order, and simultaneously arrange value and weight array according to unit value such that the item's value, weight and unitvalue remains in the same column (3*n array). 4. Now using FOR LOOP and IF condition collect maximum value items in the bag. SAMPLE CODE- for(i=1;i
@JavaAidTutorials
@JavaAidTutorials 4 года назад
knapsack problem has two variants- 1) 0/1 knapsack 2) fractional knapsack This tutorial cover 0/1 knapsack problem but your query is regarding fractional knapsack which requires greedy approach to solve.
@utpalgaurav14
@utpalgaurav14 4 года назад
@@JavaAidTutorials So, my method won't work with 0/1 knapsack problem?
@kiranvr5570
@kiranvr5570 6 месяцев назад
if Travarsing from the last index and If 'i'th element is selected is this not the formula, val[i]+maxV(i-1,C-w[i]); Please correct me if I am wrong.
@HtopSkills
@HtopSkills 5 лет назад
I like programming also
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Thanks for watching.:) Could you please elaborate what you like the most?
@Mike-mw1fu
@Mike-mw1fu 4 года назад
May you please make a video about difference between greedy and dp with example?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Will try to upload something on greedy Algorithms but will take some time.
@tanson86
@tanson86 4 года назад
Only one comment, be the robber instead of coding the logic in a computer and making it the robber.
@JavaAidTutorials
@JavaAidTutorials 4 года назад
I think this comment is more suitable for house robber problem :)
@komalashashidhar9795
@komalashashidhar9795 2 года назад
In this whole vedio I have one doubt if the input array is starting from zero then we should take v[i + 1] right .but sir u are saying v[i - 1] there I got confused. Can u explain my doubt.
@kabboghosh1853
@kabboghosh1853 4 года назад
sir plz uload longest increasing subsequences problem ,we really miss your dynamic programming video
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Got Stuck due to lockdown without my laptop, so not able to upload the contents. 😞 Will soon start uploading, once lockdown is over.
@yokeshd6011
@yokeshd6011 4 года назад
why we shouldn't use one dimensional array for storing the values?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
If you use 1D araay for storing only value then how will you fetch the exact capacity, against a particular weight.you need to store the weight -capacity mapping somewhere.
@rajughosh6173
@rajughosh6173 5 лет назад
Sir I recently used greedy method with knapsack but I'm confused which is better greedy method or dp.
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
I think you missed starting of the video. watch from 02:17 closely, you will get your answer..:)
@rajatparab8116
@rajatparab8116 4 года назад
Can u pls make graph solving technique videos similar to dp one🙏
@JavaAidTutorials
@JavaAidTutorials 4 года назад
I am trying my best to cover mos of the topics let's see how it goes? Just started with basics of ds algo.
@AbhijeeetKumarSrivastavakshiva
@AbhijeeetKumarSrivastavakshiva 4 года назад
For 10,40,60,50 example Why is knapsack 90? why not 3 units of 50, which will make sum of 150,and capacity 9m
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Sorry did not get you question could you please elaborate a little bit more on this?
@azizullah7150
@azizullah7150 Год назад
Because knapsack has rule : In the classical 0/1 Knapsack problem, you are not allowed to take multiple units of the same item. Each item can be included in the knapsack at most once (0 or 1 times). Therefore, you cannot take 3 units of an item with weight 3 and value 50.
@shaiksuhan1542
@shaiksuhan1542 4 года назад
can't we pick total 4 mobiles? which is total 4lbs and have profit of 600$
@JavaAidTutorials
@JavaAidTutorials 4 года назад
No you can't, i thing to add here, we do not have infinite number of items.
@codingfreek5737
@codingfreek5737 5 лет назад
Guys, just one tip- Don't close this video just because it's too long. *Go through the complete video to understand the concept and learn multiple ways to solve knapsack problem.* You will really love it. 👌😍 Now i will never forget knapsack problem.
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Thanks a lot, Coding freek for watching the complete video and sharing your feedback with others.
@navinchainani4721
@navinchainani4721 4 года назад
How we got 1 b free space?
@JavaAidTutorials
@JavaAidTutorials 4 года назад
As we have capacity C=4 lb. if we choose laptop of worth Rs. 300$ having weight 3lbs, then still knapsack bag has 1lbs capacity which we are not utilising. so to get maximum profit will choose phone(150$ with 1lb)+ tablet(200$ with 3lb) = 350$ with 4lb
@Leon-pn6rb
@Leon-pn6rb 2 года назад
This isn't as good as the others
@MegaNivetha
@MegaNivetha 5 лет назад
Video content and voice is not clear
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Hi @ Nivea , Can you please elaborate this issue? Why you feel that video content and voice was not clear.?
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Thanks, @ for your feedback. will check their channel and try to improve the audio quality in our videos.
Далее
0/1 Knapsack problem | Dynamic Programming
13:29
Просмотров 153 тыс.
4.5 0/1 Knapsack - Two Methods - Dynamic Programming
28:24
How I Got Good at Coding Interviews
6:29
Просмотров 1,6 млн
Google Coding Interview With A High School Student
57:24
0/1 Knapsack Problem Dynamic Programming
15:50
Просмотров 1,9 млн