I think this video needs to be made again by someone else.... can't explain any thing clearly. plss guys see into it.
@surendharrudra19743 жыл бұрын
Good efforts, fail to follow. Explanation could be improved
@shashankpandey3742 жыл бұрын
worst explaination can only be find at gfg YT😓😓
@neelalexpaul7 жыл бұрын
sorry to say this, but the explanation can be made better, comparing with the qulaity of presentation in the previous 6 videos in the same playlist which made dynamic programming look too simple :)
@GeeksforGeeksVideos7 жыл бұрын
Thank you for your feedback Neel. We shall try to keep simpler explanations in future videos. Can you provide some more feedback? Can you please pinpoint a few things that can be improved in this video? It will help us in understanding the gap better.
@BackToBackSWE5 жыл бұрын
I made an explanation on my channel
@haq_se_dkp5 жыл бұрын
@@BackToBackSWE Yours is the best channel I have seen so far. I would urge all of those interested to check out @Back To Back SWE. The tenor, modulation explanation and intuition are simply breathtaking.
@BackToBackSWE5 жыл бұрын
@@haq_se_dkp hey haha
@SaishGersappa7 жыл бұрын
The space complexity for the recursive solution is not O(1). Considering the stack usage, the space complexity is the depth of the recursive tree, O(N).
@boldschool63087 жыл бұрын
The way you have explained, unfortunately, shows that you are fed up with what you are doing...
@abhishektiwari19895 жыл бұрын
Stop criticizing.
@jinisha64854 жыл бұрын
Then don’t watch
@abmallick5 жыл бұрын
New video with better explanation. kzbin.info/www/bejne/r6jMeWCwh61ko6M
@maheshvangala84725 жыл бұрын
Dear geeksforgeeks if you had included an explanation using tabular method before implementing code this will go to next level
@engineer5851 Жыл бұрын
Implement hill climbing algorithm for knapsack - code please
@mrblacksanta5 жыл бұрын
You are literally reading out whats in your site. Cmon man , dont post just for watch time .
@ganeshchandrameesala2573 жыл бұрын
I did it like this. Will this work for all values? from itertools import combinations dic = {} for i,j in zip(list(map(int,input().split(','))),list(map(int,input().split(',')))): dic[j] = i lim = int(input()) finlst = [] for i in range(len(dic),0,-1): temp = list(combinations(list(dic.keys()),i)) for j in temp: if sum(j)
@vishalpatil49834 жыл бұрын
One of the worst Explaination I ever heard
@nitishdash7 жыл бұрын
Compared to the previous tutorials this one is really difficult to understand. Especially the optimal problem. Using k[][]
@souravmandal75276 жыл бұрын
Knapsack problem can be explained much more easily using the table
@guptagopal5 жыл бұрын
first example solution is 240 not 220
@meenumeena9194 жыл бұрын
Why weight array was not sorted ??We have to sort the weight array
@meenumeena9194 жыл бұрын
@geeksforgeeks
@vamsikrishnasai16822 жыл бұрын
What Is n in function?
@AmitKumar-we8dm4 жыл бұрын
How to get the list of items which are selected? Your function simply calculates the final value. It would have been great if you cover these cases as well...
@arnabkaycee7 жыл бұрын
explanation is very confusing.
@GeeksforGeeksVideos7 жыл бұрын
Thank you for your feedback, Arnab. We might be posting a new video soon. Could you please point out a few things that you found hard to understand? For example, is it the code explanation, dry run?
@MukeshRajput19826 жыл бұрын
Very Informative........... kzbin.info/door/oscfxTBY93lYauulG-fBRw www.mukeshrajput102.com/
@BackToBackSWE5 жыл бұрын
I cover this on my channel friend
@vetiarvind5 жыл бұрын
such an easy problem explained like you're deriving e=mc2. :-/
@bhanuprakashchinthakayala81236 жыл бұрын
sir actually in recursion i got full clarity but when its comes to the dynamic programing i'm not able get how many times does the 'w' for loop(2 for loop is iterating) can you it ..?
@surajpark5 жыл бұрын
The maximum possible value is 300 if you add a weight of 10 upto five times which will not going to break the constraint. can anyone explain how this 220 value could be the answer but not 300?
@HallaBool7 жыл бұрын
It can solved with a 1D array: int[] K = new int [W+1]; for(int i=0; i=wt[i];j--){ K[j] = Math.max(val[i]+K[j-wt[i]], K[j]); } } return K[W];
@GeeksforGeeksVideos7 жыл бұрын
Yes, Someshwar, it can be solved using a 1-D array too. And, we should use a 1-D array when the input size is going to be large. This way we can reduce space complexity from O(nW) to O(W).
@tanmaygoel28803 жыл бұрын
The explanation for the recursive solution was good but I don't know what happened when it came to DP. The explanation for the DP part could be better.
@hrishabhg4 жыл бұрын
What if all the weights are higher than asked weight. Should we consider memoization instead of a bottom-up approach?
@fakhriddinmakhmadiyorov72694 жыл бұрын
with recursion it seems rather easy, thank you
@chainsinghpawar91383 жыл бұрын
Easy 😂
@soumalyasahoo26645 жыл бұрын
The dry run of the dp approach is solved in a wrong fashion.In the code you are either taking the i-1 th item or ignoring it then proceeding further till n-1 the item.But in the dry run you first considered the n-1 th item then you went down to 0. Am I correct?
@UsualParadox7 жыл бұрын
Hey guys, first of all, thanks for all the great content you've put out! Amazing, thanks! I do have a question about the code above: everything pretty straight forward until it gets to this line: M[j][i] = max(M[j][i], M[j-1][i-weight[j]]+value[j]); more specifically: [i-weight[j]]. My question is how is this working? how is i minus the value store in weight[j] giving us an index within range?
@prathamkushwah16702 жыл бұрын
it is not giving us index within bounds, and so c++ gives random large negative garbage values for that index, so the max value selected is always 0 or any other (and not one with index[ i - weight[i] ]
@23loges17 жыл бұрын
Good videos. one suggestion... instead of directly jumping on to the solution.... please provide the reason for the particular approach in a real life logic sense, as it would help understand why the solution is used, than just how the solution works. These videos really help lot of people.. great service guys...keep up the good work...
@GeeksforGeeksVideos7 жыл бұрын
Thank you for your feedback, Mark! :) We will keep in mind your suggestion.
@elmesiasyourpapi8 жыл бұрын
Thanks for the videos. Can you do a reproduction list just for dynamic programming?
@GeeksforGeeksVideos8 жыл бұрын
You're welcome. Yes. We're working on adding more videos.
@AshishSharma-li1dq5 жыл бұрын
very bad explanation
@AshishGupta-rh3jf6 жыл бұрын
not well explained and presenter is eating during presentation .. which is very awkward
@HuongLe-qo7xw4 жыл бұрын
How to include the list of weight of final result in python?
@TheGreatOne4287 жыл бұрын
the mic quality is bad. I would have read from a script to ensure I do not stutter while speaking.
@somyamishra55385 жыл бұрын
By using tabulation explanation can be made better..
@sahulrajhansa83634 жыл бұрын
I think creating a basic visualization of the 2d array used in dynamic programming will help us understand this problem better
@jubaer.hossain6 жыл бұрын
The explanation doesn't make any sense! Confusing
@sandeshavhad77378 жыл бұрын
I am referring your site for dynamic programming, its very helpful Please post more videos on Dynamic Programming (algorithm and its implementation in Java). Thank You :)
@GeeksforGeeksVideos8 жыл бұрын
Thank you, Sandesh. We're working on adding more videos.
@ShivamKumar-gy4tz5 жыл бұрын
@@GeeksforGeeksVideos Ir's the best portal for CSE students in the world
@soumalyasahoo26645 жыл бұрын
Why didn't you use the table to explain that?
@neeleshrajpoot14935 жыл бұрын
very poor explanation
@shubhamdhiman51987 жыл бұрын
dude you are not at all clear. The explanation is far more simpler than this video. P.S: Please turn off the fan
@YouTuber-lb9ot7 жыл бұрын
Not a good presentation.. seems to be novice who is rushing into solution... could have taken a retake with something better.. good luck next time.
@GeeksforGeeksVideos7 жыл бұрын
Thanks for the feedback. It is one of the earliest of our videos. You will find better presentation in the recent ones. :)
@tedsprogz7 жыл бұрын
I mean this in the nicest way possible, but i cannot understand anything you are saying. Your accent is too thick for me.
@GeeksforGeeksVideos7 жыл бұрын
It's perfectly fine to say that, Theodore. Thank you for your feedback. I had planned to add subtitles to this video but somehow time keeps flying off my hands. Anyway, I'll add subtitles to this video asap.
@danieldil61987 жыл бұрын
The complexity is 2^n but on the example tree you have 2^n+1 function calls. Why is that?
@vinaykumar55084 жыл бұрын
Thanks a lot...
@sivar43007 жыл бұрын
If you don't depict it with 2D array, its very hard for people to understand.
@GeeksforGeeksVideos7 жыл бұрын
Thank you for your feedback, Shiva. We shall incorporate this in the future video. This was our first video on Dynamic Programming, naturally, it's not as good as our recent videos on Dynamic Programming. You can see the 1D/2D arrays in our videos on LIS: kzbin.info/www/bejne/hKSXfXabmrR5iZY LCS: kzbin.info/www/bejne/fpi4gIp4ZbinhKc
@7369398 жыл бұрын
Hello please tell me on 6:29 why in second bracket when you didn't included n-th element it is n-1. I think it should be n-2 on second bracket - because you didn't include the last element.
@GeeksforGeeksVideos7 жыл бұрын
Hi Sam, The 'n-1' over there signifies the remaining number of items to pick from (and not the last element). If you notice, in the first case, when we are including the nth item, we have written val[n-1] (signifying the nth element in the array) and in the function call on the right we have 'n-1' (signifying the remaining number of items to be evaluated to include or exclude in the knapsack.) So, in the second case, where we don't include the nth item, we have not written val[n-1] (the nth element) and in the bracket, we have written 'n-1' (with same meaning as above).
@TravellingBeast1235 жыл бұрын
good job
@deepchhatbar32377 жыл бұрын
If we select 2 times 20 and one time 10.....we will get 100+100+60= 260......i think this is the correct answer..
@indowestlife6 жыл бұрын
We cannot select an item twice
@deepchhatbar32376 жыл бұрын
Aakash Verma yeah i got it afterwards..👍
@bhargavreddy70386 жыл бұрын
forgiven 2:31
@tedsprogz7 жыл бұрын
How do i allow duplicates? say i want to add an item twice
@GeeksforGeeksVideos7 жыл бұрын
Please take a look at this: code.geeksforgeeks.org/3m3Fl5 I have added two items having the same value and the same weight. The program gives correct output. It does allow duplicates as long as it's there in your input array. You don't need to handle it as a special case. Does this answer your query?
@shubhambhattacharya60467 жыл бұрын
Nice one
@yohosuff7 жыл бұрын
First of all, thanks for these videos. They are great! :) That being said, I was hoping for a demonstration of how to manually fill in the dynamic programming grid. I'm sure one could work it out from the provided code, but it's nice to see an actual example. I find it very effective for understanding the problem. An example of what I'm talking about is in "Dynamic Programming | Set 4 (Longest Common Subsequence) | GeeksforGeeks" at 2:02 (kzbin.info/www/bejne/fpi4gIp4ZbinhKcm2s).
@GeeksforGeeksVideos7 жыл бұрын
Thank you, Joey! Good to hear you liked the videos. :) This video was actually prepared a long time back before we made the other videos. And, we're aware that it's lacking the dry run where we fill the table. I will try to add another video with the dry run in the coming few weeks.
@yohosuff7 жыл бұрын
Awesome! A dry run would be great. Thanks! 😀
@RafiqulIslam-hr5on8 жыл бұрын
10+10+10+10+10=5*60=300 is it wrong ? i think this is the answer ..
@GeeksforGeeksVideos8 жыл бұрын
Yes, Rafiqul, it's incorrect. Why? Because we have only three items in the example discussed above. In your example, you are probably assuming that we have an infinite supply of items.
@rethink20s5 жыл бұрын
Great job bro
@ik_yola7 жыл бұрын
Poor explanation!
@GeeksforGeeksVideos7 жыл бұрын
Hi, Could you please tell us which part did you find hard to understand? Or, any suggestion on how we can improve?
@sudhansupradhan68917 жыл бұрын
nice one
@GeeksforGeeksVideos7 жыл бұрын
Thank you, Sudhanshu! :)
@monikajha42396 жыл бұрын
good job!!!
@SUBRONEEL7 жыл бұрын
sry but I had to say this .. compared to the other videos this video was really confusing..!
@GeeksforGeeksVideos7 жыл бұрын
Thanks for the feedback. It is one of the earliest videos that we made. We have tried to keep the videos simpler from then on.
@SUBRONEEL7 жыл бұрын
then can you please upload a video with simpler explanation on this problem. if possible :) keep up the good work.!