5 01 Knapsack Top Down DP

  Рет қаралды 613,822

Aditya Verma

Aditya Verma

Күн бұрын

Пікірлер: 913
@kushmidedhia7175
@kushmidedhia7175 4 жыл бұрын
Hey very good explanation, I agree on the comment that direct tabulation approach is not very intuitive to normal human mind, we have to build up the solution starting from recursion and memoization. Just one small comment, the tabulation approach is not top-down but bottom-up. It is called bottom-up, because we start the solution from base case (initialize matrix using base case) and build the solution to the top (t[n][w] in this case).
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Oh yeah. of course I am glad you pointed it out. I messed up, those two terms have always been confusing to me !! 😅However our solution is still correct af, I am glad names don't effect the way you do things !! Let's just call one Memoization and the other Tabulation to avoid confusion. What I did in this solution is Tabulation. Thanks for pointing is out tho !! Keep watching and share ✌️
@anmol-gupta
@anmol-gupta 4 жыл бұрын
@@TheAdityaVerma I'd suggest adding a video after the introduction of the playlist that explains the difference between top-down (memoization) and bottom-up (tabulation). You can mention it in that video that whenever you say "top-down" in the following videos, you actually mean "bottom-up" or "tabulation". It's important that no one learns a wrong thing. Other than that, your videos are very helpful. :)
@deepamgupta8011
@deepamgupta8011 4 жыл бұрын
The videos are good, but even a minor mistake in standard terms also may lead to failure no matter the explanation is very good. You ought to add a frame at the start of each video that wherever you refer top-down, it is actually bottom-up, else, people will start losing faith. My intention is not from any means to hurt you, but since, your explanation is good, you need to be full-proof.
@stark_mark1107
@stark_mark1107 4 жыл бұрын
@@TheAdityaVerma So the recursive solution was top-down approach as we started at the top and kept making recursive calls until we reached the base case and then started returning values while the tabulation one was bottom up as explained in the comments, right??
@saurabhmarpadge7498
@saurabhmarpadge7498 4 жыл бұрын
@@stark_mark1107 Ya exactly.
@snehilsinha4689
@snehilsinha4689 3 жыл бұрын
I tried learning this from hell lot of YT channels like Tushar, Jenny, Apna College, Anuj Bhaiya, even MIT Open Courseware. One word, all are trash and I could understand nothing from them! Only a true coder like you who actually works in a company and who has grinded so hard to achieve it can explain this with such clarity. Tysm brother! 💓
@pranavJha93
@pranavJha93 20 күн бұрын
they aren't trash btw
@nehaagarwalla9004
@nehaagarwalla9004 Жыл бұрын
Bro I am a 15 years experience engineer.. your explanation and determination to make everyone understand this topic hits hard
@muditkhanna8164
@muditkhanna8164 10 ай бұрын
after 15 years why are you here for dp tutorials. i mean dp is basically caching. you might've already knew that.
@yasirmalik198
@yasirmalik198 9 ай бұрын
@@muditkhanna8164 YOE?
@pranavJha93
@pranavJha93 20 күн бұрын
@@muditkhanna8164 let her learn bro
@kritikatripathi806
@kritikatripathi806 4 жыл бұрын
This is just to let you know that this is the first time when someone has explained me "how to code" with such clarity! I am really very amazed and motivated today because of this video playlist.
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Glad it helped you !! Please consider sharing the content with your friends or college to help this channel grow !!
@ankushroy919
@ankushroy919 4 жыл бұрын
@@TheAdityaVerma bhaiya yahi to prblm hai market me itna competition hai ki share karte wakt dar lagta hai actually nahi kar pata hu baki likes or comment to milega
@user-stevegjffuhdry
@user-stevegjffuhdry 3 жыл бұрын
@@TheAdityaVerma will definitely! keep on posting, love the vids
@buzzfeedRED
@buzzfeedRED 3 жыл бұрын
@@TheAdityaVerma Excellent Explaination. But in the GFG knapsack problem. The memoize solution is not accepting, while the top-down is accepted. There is a time limit exceeded error.
@ankitbhardwaj7363
@ankitbhardwaj7363 3 жыл бұрын
@@buzzfeedRED 0/1 knapsack or unbounded knapsack ?
@vibhuagwl
@vibhuagwl 4 жыл бұрын
I am working in IT for the last 7 years I have tried many tutorials for data structure and algorithm but no one explained like you. I really appreciate your effort. Please make the videos topic-wise from basic it can be paid or free.
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks a lot brother !! I am glad you liked it !!
@coolbuddy8386
@coolbuddy8386 4 жыл бұрын
I also felt the same way, thank you so much for time and effort Aditya Bhai. As you said all the youtubers just explained the tabular method but no one taught the same u r teaching i.e converting recursion into tabular method. hats off for your explanation and ideas. Keep uploading such problems and videos I am loving it.
@jameysiddiqui6910
@jameysiddiqui6910 4 жыл бұрын
This video is great having great explanation, having two minor mistakes. 1) Top down is actually bottom up. 2) At time 29:37 it should be be T[n-1][w-wt[n-1]]
@ankitmishraR
@ankitmishraR 3 жыл бұрын
yes exactly
@klbamniya
@klbamniya 3 жыл бұрын
Agreed
@bokkamanideep9893
@bokkamanideep9893 2 жыл бұрын
Why taking dp[n+1][w+1] for what that +1 please resolve my doubt
@balvindersingh1329
@balvindersingh1329 2 жыл бұрын
@@bokkamanideep9893 The size of value or weight array varies from 0(no element) to n (all elements) . So we have to select the size of tabulation table t[n+1][W+1] so as to accommodate all possible combinations from 0 size and weight to n size and W weight
@prateekmadan6936
@prateekmadan6936 2 жыл бұрын
Can you please explain why it would be w-wt[n-1] ? Isn't the second condition for the case where we are not selecting any element? When we are not selecting anything, what weight are we subtracting?
@capone2676
@capone2676 3 жыл бұрын
Why cant I double like? This deserves a thousand likes. You opened a whole perspective of DP for me. Using recursion first to explain and then coming to bottom up approach was a stroke of masterpiece. I've always wondered how to solve DP with tabulation but this DP series is a life saver.
@ClassyKSC
@ClassyKSC 4 жыл бұрын
Didn't realize the 40 minutes were over till you said that "ab aapko samjh aa gaya hoga". That's how well you taught.
@shubhanshusaxena1232
@shubhanshusaxena1232 4 жыл бұрын
this is called as TEACHING Dynamic Programming!! great work Aditya! :)
@damercy
@damercy 4 жыл бұрын
In my 3rd year now, and till date I've tried to learn from so many different resources but nothing like these videos. A genuine thank you from the bottom of my heart for keeping shit real and free. Stay the same when you hit those subscriber milestones on YT because you will. And soon! ✌️💯
@yogeshyts
@yogeshyts 3 жыл бұрын
placement hui ky?
@damercy
@damercy 3 жыл бұрын
@@yogeshyts Haan bhai, 10LPA
@yogeshyts
@yogeshyts 3 жыл бұрын
@@damercy company?
@damercy
@damercy 3 жыл бұрын
@@yogeshyts It's an early stage startup man. :)
@damercy
@damercy 3 жыл бұрын
@Adarsh Chaurasia Hey thanks! :)
@ramankumar9856
@ramankumar9856 4 жыл бұрын
I am a student in IIT , was finding it difficult to solve it many youtubers just doent tell us why we created table why we put t[i][j] = max something , but after listening to this one video whole Dynamic programming is looking easy kudos to the person , am a fan of you now
@AlbertoRodriguez-oe6jo
@AlbertoRodriguez-oe6jo 3 жыл бұрын
Code for all 3 approaches: Recursion => Memoization (Top down) => DP (Bottom Up) //1. Recursive Approach int knapSack(int w, int wt[], int val[], int n) { //Base Case if(n==0 || w==0) return 0; //Choice Diagram Code //1. Choice to include item or not if(wt[n-1] w){ return 0 + knapSack(w,wt,val,n-1); } } //2. Memoize above recursive code (top-down) int knapSack(int w, int wt[], int val[], int n){ vector t(n+1, vector(w+1, -1)); return fun(w, wt, val, n, t); } int fun(int w, int wt[], int val[], int n, vector& t) { //Base Case if(n
@shubhadarajmane7323
@shubhadarajmane7323 Жыл бұрын
In Memoization why your code is giving the wrong input when the vector t is declared globally?
@the_only_one9415
@the_only_one9415 Жыл бұрын
is'nt it v[i] intead of v[i-1]
@howitzerlance9689
@howitzerlance9689 Жыл бұрын
@@the_only_one9415 No bcuz we are checking for the wt[] array....And it starts from 0 index. Here indexing for the matrix is one more than that of the input array.Hope you get it.
@subramanyakrishna6018
@subramanyakrishna6018 Жыл бұрын
Can I please know why we require second else? when in If only we have the same statement?
@kush-cp8kc
@kush-cp8kc 2 жыл бұрын
BROooo ....I dont know how to thank you ....I was really looking for this exact way of teaching ... and yesterday only my senior suggested me from IIT Guwahati to follow you ...and i wasn't able to sleep after seeing the way and quality of content you have provided ....i was so eager to learn and watch ....thank you so much , really .
@BHARATKUMAR-dk1ij
@BHARATKUMAR-dk1ij 3 жыл бұрын
First time i have seen someone connecting recursive code and tabular code like this, your method of teaching is just amazing.
@MegaDeepak56
@MegaDeepak56 5 ай бұрын
I might be wrong but this technique is called Bottom-Up (Tabulation) and the technique you taught in last video is called Top-Down (Memoization) technique. I have learnt basic concepts from your tutorial and it obviously helped me to understand DP fundamental concept. Thanks bro for your skills to share with us.
@shresthgupta2670
@shresthgupta2670 2 ай бұрын
yes buddy yuo are right
@amitray769
@amitray769 Ай бұрын
thanks, man, for letting me understand the DP for the first time properly after 5 years of software engineering. I'm really grateful to you for this.
@JyotiSharma-dm8ls
@JyotiSharma-dm8ls 3 жыл бұрын
It's easy to find good developers out there but hard to find a good teacher. Paper pen approach is best to connect with the audience, in making them understand why something is being done and what is the thinking process to approach a problem. There could be minor mistakes here and there in what you have explained (my observations, based on the comments other viewers have left) but if the viewers can pickup on those means you have done a great job already in developing their thinking and they are following along with your explanations and thats what a teacher does :) . You have reminded me of college days where friends just used to discuss and solve problems using our basic tools -- pen, paper and friendliness of language.
@jayparekh1992
@jayparekh1992 3 жыл бұрын
i have spent more than 4 months to only understand DP, But I must say that what you have taught in 4 videos, if i had see it earlier it will save my 4 months. very good explaination.
@Learner010
@Learner010 4 жыл бұрын
at 29:44 you take one time i as W and j as n while taking maximum .. completed 5 video and you explained very well..Pure Gem
@wholeegg
@wholeegg 4 жыл бұрын
One day I'll succeed in spinning pen like you.
@meenalagarwal4516
@meenalagarwal4516 4 жыл бұрын
it took me entire 11th and 12th XD
@blasttrash
@blasttrash 4 жыл бұрын
I can spin using both hands :P Thats the only thing I learnt during IIT JEE preparation. Of course its not enough to get into IIT lol :P
@Lime-rr6te
@Lime-rr6te 4 жыл бұрын
practice jaari hai bhai
@0anant0
@0anant0 4 жыл бұрын
There is a pen available that has spherical weights that move towards the end to create centrifugal force -- it makes spinning very easy. Its called, (what else) spinning-pen. There is another spinning technique where you pass the pen between all the fingers -- check it out in the 'classroom training' scene in TopGun. Who knows what I am talking about?
@amansinghgautam9578
@amansinghgautam9578 3 жыл бұрын
@@0anant0 you can spin any pen lol
@mastermind82134
@mastermind82134 4 жыл бұрын
bro why did u stopped uploading : ( , want series on graphs and advanced data structures too . your teaching is friendly , like we teach each other in hostels : ).
@sarthakpal8231
@sarthakpal8231 4 жыл бұрын
that hostel point was so damn relatable xD
@mrsukki8158
@mrsukki8158 3 жыл бұрын
He is dead bro 😭
@AbhishekKumar-im2xd
@AbhishekKumar-im2xd 3 жыл бұрын
@@mrsukki8158 stop spamming fake news
@Aks-47
@Aks-47 3 жыл бұрын
@@mrsukki8158 tera baap hoga, aditya verma nahi
@shaikfahim1232
@shaikfahim1232 3 жыл бұрын
@@mrsukki8158 aisa nahi hosakta
@arindamdas3464
@arindamdas3464 3 жыл бұрын
Hands down the best explanation on DP. You are helping those who cant afford to join expensive courses online. Keep it up brother !! Thanks !!
@debbh274
@debbh274 4 жыл бұрын
Honestly, even if you pay a lot of money, you wont find the clarity with which you are explaining. Thoroughly enjoying it. Great work....Try making your videos in English also, your viewership will climb 10 folds...Also, your videos shows the huge number of hours you grinded to gain the clarity with which you are explaning. Great work and thanks a lot.
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks a lot for such a great comment brother. You made my day !! ❤️ Do share !!
@devanshmesson2777
@devanshmesson2777 4 жыл бұрын
Thank You So Much Brother.I Don't Think Anybody else is teaching the Crux of Dynamic Programming So well!Your Videos are Valuable for Beginners!
@himanshugupta7010
@himanshugupta7010 3 жыл бұрын
Bro noone literally noone has this level of understanding . the way you explained it was way better than anyone out there . in my case I never studied DP from any where 'coz I was afraid but now I am damn confident to solve any problem because now I know how to approach the problem . thank you so much bro .. and a huge respect to you . Aditya Verma OP
@jasmeen2541
@jasmeen2541 4 жыл бұрын
Hands down!!!🙌🙌 You're the BEST teacher ever! No one has ever explained why of every single thing in DP, and you've done that ❤
@kingrajput6202
@kingrajput6202 3 жыл бұрын
Finally someone who is teaching how to code a solution , rather than just telling the solution most of the youtubers and all my university professors just show the algo and don't give a damn about code , I am ready to pay for a course of such caliber
@agarwalaadi99
@agarwalaadi99 3 жыл бұрын
God level explanation brother !!! I was so afraid to start DP from much time. But when I started watching this playlist, it was so effortless for me to understand it . You made my day sir :) God bless you !!
@ujwalsingh2636
@ujwalsingh2636 3 жыл бұрын
U r too good man... I have viewed most of the utube videos on dp but no one has xplained in so much depth.. U have my respect🙏
@mohitsoni4352
@mohitsoni4352 3 жыл бұрын
Amazing explanation, I m final year student from tier3 college. I was shit scared with coding rounds as our teachers hv nvr taught us these things. Our clg placemnt was limited to Infosys TCS, finally after watching your videos I hv gained the confidence to try for Product based companies. I will surely meet you in person once Im placed in one of those companies. Love your work bro, please keep uploading videos these are really really helpful for students like me. Thank you so much.
@vijaychander2177
@vijaychander2177 4 жыл бұрын
Bhai alag level pe samja rahe ho. Most of the people don't understand how to teach. This is the perfect example of how one should teach anything. Thanks please keep the work and continue uploading videos
@kalagaarun9638
@kalagaarun9638 4 жыл бұрын
pehli baar top down ka matrix bana ke use kata nhi 😅😅 kudos to your effort, sir !! 🙌🙌
@sreeramsuresh8947
@sreeramsuresh8947 Жыл бұрын
The best among the ones which exist...Explaining such a hard topic in a very simple manner. Hats off
@vijaypalmanit
@vijaypalmanit 3 жыл бұрын
I could learn and master recursion just because of you, otherwise I was always afraid of it, thanks a lot for your effort, couldn't learn things in college due to my health issue, but learning now and your videos are helping a lot, I am having 10 years of experience in IT.
@samratmukherjee7131
@samratmukherjee7131 24 күн бұрын
For anyone wondering how are we managing to do this transition from the recursive calls to the 2d array, just think of it like this: Recursion defines subproblems, and each subproblem is carefully constrained by the inputs (e.g., remaining capacity, items). When we memoize these results in the DP table, the indices correspond directly to valid subproblem states. By construction, every state in the DP table refers only to previously solved subproblems, which ensures that no out-of-bounds access occurs.
@lakshmisravyaharivanam6045
@lakshmisravyaharivanam6045 4 жыл бұрын
I was searching for such a KZbin channel on dynamic programming that would help me think how to think and I am glad that I found your channel.. More power to you !!!
@karanmistry3018
@karanmistry3018 4 жыл бұрын
So far I liked your way of approach ...the great part about your video is that you show one way of approach and than to counter that you show other along with the reason of chosing the later one....it's builds up logic very effectively....will make effective use of whole playlist. Thanks sir 🙂
@aryanyadav3926
@aryanyadav3926 2 жыл бұрын
The amount of efforts put in explanation is commendable! Thanks a lot sir!
@akhilk5121
@akhilk5121 4 жыл бұрын
I have nothing different to say!Commenting just so the dumb youtube algorithm can see this gem and start suggesting. I was trying to learn knapsack and accidently found your playlist comment at the corner of famous video where people were struggling to understand the concept. I was skeptical and almost skipped seeing the video is in Hindi since my hindi is not so great. Somehow i watched the first one and now i am in love with this. You are such an awesome teacher , please keep doing this. Much Love.
@tushargarg6359
@tushargarg6359 4 жыл бұрын
You are one of the greatest KZbinr for the learning data structure. I was having a lot of difficulties understanding the recursion. Now a concept is quite clear. I think you should start your startup similar to algoExpert. You have great potential to explain everything which no one has. Other people just discussed solution but you discussed how to reach that solution. Could you please start the videos for "FAANG" companies? Complete tutorial. I will never mind taking a paid membership for it. I solved more than 50 problems in recursion but no one tells about the choice diagram. Please let me know how did you learn those things? Did you refer to any book?
@immrhrr
@immrhrr 3 ай бұрын
after watching this video,I feel like ab toh apun hi dp ka bhagwan hai thankyou so much ,I am able to visualize everything about memoisation and tabulation now
@blue_jerry
@blue_jerry 4 жыл бұрын
at 29:30 in the bottom-up approach instead of t[w-weig[n-1]][n-1] it should* be t[n-1][w-weig[n-1]].
@ankitsagar8379
@ankitsagar8379 4 жыл бұрын
Rasik Mahajan was waiting for this comment
@vritansh14
@vritansh14 4 жыл бұрын
correct! Got me confused. Now it's all clear
@tomy7424
@tomy7424 4 жыл бұрын
Right, He should be more focused when writing code, I know it's easy mistake to make but we can't doubt him as well and start thinking to our self why is that.
@0anant0
@0anant0 4 жыл бұрын
This reminds me of dfs grid problems where instead of considering mx[r][c], they consider mx[c][r]. (mx = matrix, r = row, c = col). Has anyone seen this?
@saketsrivastava4953
@saketsrivastava4953 3 жыл бұрын
I was searching for this comment , I was confused too -_-
@ramyaneekashyap1467
@ramyaneekashyap1467 2 жыл бұрын
Hi, great videos on DP. But I think tabulation, that is deliberately filling the table from the most solvable(or smallest) problem is the bottom-up approach. the backtracking with memo/caching is Top down, where we take the entire problem and keep hammering on it till it is broken into smallest solvable pieces and cache results for reuse
@pavanala2200
@pavanala2200 4 жыл бұрын
One of the Best dynamic programming course.. ever❤️❤️
@yashsharma6112
@yashsharma6112 2 жыл бұрын
Great Lecture on DP. Thank you very much. I am a newbie to DP but I have idea of other DS and recursion. I thought that DP is gonna be tough, but you made it easier for us. The way you approach a DP problem is awesome. I will remember your each and every words. DP jaisi h waisi likhoge to DP ka solution likh loge. Never directly start with tabulation. DP is enhanced recursion. Agar recursive calls me tree bann rha h aur overlapping subtree dikhe to DP lagega. Aur question me optimal pucha hoga
@llliiilll3624
@llliiilll3624 4 жыл бұрын
The initialization part can be done in O(n) instead of O(n*w). Use one for loop (from 0 to w) to set t[i][0] = 0 and another for loop (from 0 to n) to set t[0][i] = 0.
@Rajat-Sharma1
@Rajat-Sharma1 3 жыл бұрын
haa but woh abhi main nahi hai bhai, main hai yeh DP😂😂
@daisychain8011
@daisychain8011 3 жыл бұрын
You're 100% correct though the rest of the algo is O(n*w) anyway so it doesn't really matter Asymptomatically
@sanjayjoshi8807
@sanjayjoshi8807 3 жыл бұрын
bro does it matter if I write outer loop for W and inner loop for N ???
@jaydalsaniya6986
@jaydalsaniya6986 3 жыл бұрын
Ab ate hai yeh log , jo padhane vale k samne usko sikhate hai .
@amishasingh4606
@amishasingh4606 3 жыл бұрын
kuch bhi...isse khaali 1st row and 1st column hi initialise hoga
@hiteshsondhi
@hiteshsondhi 2 жыл бұрын
bhai aap kaise samjaathe ho ..gajab hai ... I have seen multiple videos on DP and mostly they just repeat the existing solution, but the way you mapped recursive to top-down is just amazing. I always struggled to find the top-down but never realized there is one-one mapping with recursive
@devrajsinghshekhawat6617
@devrajsinghshekhawat6617 4 жыл бұрын
Fadd explanation hai bro.Your concepts are crystal clear, recursion par bhi playlist upload krdo brother
@satyamabhishek1317
@satyamabhishek1317 3 жыл бұрын
best DP explanation till date either on free platform or on paid courses. :)
@ajayraj1
@ajayraj1 3 жыл бұрын
This is Epic 🙌, thanks alot sir for this
@kumardivyanshu7327
@kumardivyanshu7327 3 жыл бұрын
Finally, I understood the lines of code. Earlier, I was getting an error. Thanks!
@curiosity9861
@curiosity9861 4 жыл бұрын
Everything u taught in this video is on point love it🔥🔥🔥🔥.
@rupinraj4910
@rupinraj4910 Жыл бұрын
i never ever thought i would be able to understand tabulation(bottom-up solution) but its all becuz of you, i got this .thanks alot man
@praveenchouhan6388
@praveenchouhan6388 4 жыл бұрын
The beauty of your explaination is it gave me a feel as I myself have solved and analyzed the approach and solution of the problem. This is one of the best youtube videos i have ever watched!!!!!!!!!!!!!!!!!thanks keep uploading.............
@suvam2perfect
@suvam2perfect 4 жыл бұрын
You madee brave enough to encounter Algorithm and coding ❤️
@vivekverma4012
@vivekverma4012 4 жыл бұрын
i switched to your next video but suddenly i realised that i need to say thanku for your amazing explanation and great efforts.
@akshatjain6854
@akshatjain6854 4 жыл бұрын
Superb Bhaiyya while other youtubers are just making us mug up the code, you came up as a live saviour! Keep uploading. Also can you please make videos on general topics like how and where to study theory subjects, how to clear online test etc. It would be really helpful
@noobichesser9434
@noobichesser9434 3 жыл бұрын
Engrave this in stones and history will witness that best ever tutorials created for Dynamic Programming on entire planet was created by Aditya Verma. Period.
@vivekagarwal4853
@vivekagarwal4853 3 жыл бұрын
Hi Aditya, Thanks for the amazing explanation but I think at 37:26, in the 'if' condition, we should reduce the weight of the bag with previously filled item while comparing the current item's weight like 'wt[i - 1] < weightOfbag - t[i - 1, weightOfbag]'.
@komaldeepsingh6356
@komaldeepsingh6356 3 жыл бұрын
Yes... I also noticed same
@kirtikhohal3313
@kirtikhohal3313 2 жыл бұрын
no, it's not required, the current item's weight that is wt[i-1] is being compared to the jth value at that time, that is the current weight the bag or knapsack is holding.
@scramjet7466
@scramjet7466 Жыл бұрын
You are doing god's work. Very thankful to you. You tell us what we are trying to do fundamentally, which make it easy and quick to understand as compared to using definitions and bookish language. edit: I find it better to initialize value[] and wt[] arrays to n+1. this way there is no confusion in indexing it t[][].
@PritamKarmakar
@PritamKarmakar 4 жыл бұрын
Amazing bro, so easy to follow. Keep rocking. Felt like I'm in my college days, some of my topper guys explaining me :)
@varungoel6981
@varungoel6981 3 жыл бұрын
Today I got selected in Flipkart all because of your videos Aditya! Besides learning technical stuff, I got to learn from you on how to handle and approach complex problems. Thanks a lot! I really owe you a lot, can't msg on LinkedIn since you haven't accepted my request but I'm gonna ping you as soon as I join to thank you :)
@purandarparitosh
@purandarparitosh 4 жыл бұрын
just one word bhaiya, just one: BRILLIANT!!!!
@amberkumar2359
@amberkumar2359 3 жыл бұрын
By far the best video on programming foundation for DP on KZbin or any other educational site. You got an unique and excellent way of expressing complex concepts with simplicity. I hope you will create more videos.
@jainlokesh318
@jainlokesh318 4 жыл бұрын
Great effort by u Man....Thanks a ton..!!! Waiting for the recursion playlist to be uploaded...I request you to please do it asap.. Till then if you can recommend any material to ace recursion would be a great help :)
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Will upload more video in the month of may !! Till then keep on sharing and help this channel grow + that keeps me motivated to make more videos !! ✌️❤️
@sayantandas99
@sayantandas99 4 жыл бұрын
Bro.... Really from my heart.... I thank you!. I have not been able to pass coding rounds due to questions in DP. I really feared. But the way you have explained.. just awesome!. Please go on!... Thank you! :)
@gandharavkatyal822
@gandharavkatyal822 4 жыл бұрын
Hi bro, Great initiative. Please make videos on graphs as well :) It will be a great help.
@pratikjain3323
@pratikjain3323 3 жыл бұрын
Finally, after 36 minutes, my anxiety of changing n,w -> I, j ended. Through out the video while you were writing the code for iterative I was like "Bhai i,j hoga .. n,w nahi !!! ". Although, I trusted you enough to watch the complete video and then you said.. "Saare n, w ko i, j me badal denge"... Anxiety Ended!
@suvodeeepbiswas6360
@suvodeeepbiswas6360 4 жыл бұрын
We are just awesome ..Lot of respect and lot of love to you sir❤️
@SushilYadav7
@SushilYadav7 4 жыл бұрын
ME Wayne We?🤣
@suvodeeepbiswas6360
@suvodeeepbiswas6360 4 жыл бұрын
I mean u sir
@manishbolbanda9872
@manishbolbanda9872 3 жыл бұрын
bruh Dil se thank you...You made things crystal clear in one go. way of explaination is also good. Hope to complete this playlist in 10 days.
@anirudhlok2047
@anirudhlok2047 4 жыл бұрын
Hi Aditya, I had one question, how does replacing n with i and W with j work? because we check from end of array if the item's weight is < W ie (wt[n-1]
@sreeraghuvardhanvangipuram9547
@sreeraghuvardhanvangipuram9547 Жыл бұрын
Did you figure it out? If yes can you reply with an answer.. I have the same doubt
@SunilSahu-li4cy
@SunilSahu-li4cy 4 жыл бұрын
well explained by you sir. A few days ago I have seen the solution of knapsack in algoexpert ds algo series. At first time I couldn't able to understand what and how the things are going because the problem was started itself from top down approach and today you have cleared my all doubts and the multiple solutions of it. I'm very thankful to you. 🖤
@Ji-yoon
@Ji-yoon 4 жыл бұрын
Thanku so much for this amazing lecture.......!!!!!!
@maniyadav3256
@maniyadav3256 2 жыл бұрын
bhai aap ka 41 min is equivalent to my 3hours, because you are amazing DSA teacher,
@GAURAVSINGH-hu3qp
@GAURAVSINGH-hu3qp 4 жыл бұрын
bro ur just too good
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks brother, share to help this channel grow !!
@SunirbanVlogs
@SunirbanVlogs 2 жыл бұрын
I usually don't hit like button on much videos,but you have to hit like in all his videos,they all are so good
@amitgohri1622
@amitgohri1622 4 жыл бұрын
aren't you mistaking iterative solution saying it top-down which rather should be bottom-up ?
@divyarajsinhpadhiyar4442
@divyarajsinhpadhiyar4442 7 ай бұрын
do doubt one of the best teacher i am confuse in between how to convert recursive code to tabulation and you made it very simple thank you dp King.....
@tusharnain6652
@tusharnain6652 2 жыл бұрын
We don't have to initialize the dp matrix differently, we can do it in the same for loops, here is the c++ code // Tabulated Approach (Bottom-up)------------------------------------------ int knapSack_tabulated(int W, int wt[], int val[], int n) { vector dp(W + 1, vector(n + 1)); for (int i = 0; i
@Shadow-lx9rh
@Shadow-lx9rh 2 жыл бұрын
Thank yoooooou soo much for the code 😭
@abhishekmohanty232
@abhishekmohanty232 4 жыл бұрын
bhai kya he bolu .majja he aaaa gaya ,10 times batter than college professors. recursion sikhane ke kiye eek video series bana do pls.
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks brother, Do subscribe and share, that keeps me motivated to do more !! and yeah its in my to-do list.
@muskangoel897
@muskangoel897 4 жыл бұрын
Is there any specific reason you took t[n+1][w+1] and not t[w+1][n+1]?
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
No, Other way around will work too !!
@AuritraDey
@AuritraDey Жыл бұрын
An elder brother holding the hand of his younger brother and introducing the world of Dynamic Programming. ❤
@joshiadvait8
@joshiadvait8 4 жыл бұрын
Bhai recursion sikha do acche se ek bari....... fir DP halwaa lagegi
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Will be uploading more videos in may till then keep sharing to help this channel grow + thats motivates me to make more videos !! ❤️✌️
@anikettatte7408
@anikettatte7408 4 жыл бұрын
@@TheAdityaVerma Bhaiya ..in desperate need of a playlist on Recursion..!! Love your work
@ritiksingh-dq2gs
@ritiksingh-dq2gs 4 жыл бұрын
Make video on dp for grid
@sushmitagoswami2033
@sushmitagoswami2033 Жыл бұрын
Other paid EdTech providers please dekho inko.. Nobody can explain this way! Hats Off Bro!
@vishalchincholi4490
@vishalchincholi4490 4 жыл бұрын
THIS VIDEO SHOULD BE RE-TITLED AS "BOTTOM UP APPROACH" WHICH IS TABULATION.
@Ganeshsp1
@Ganeshsp1 3 жыл бұрын
This was what I too was wondering as this is Bottom up approach as the subproblems are solved first and then we go to the top to solve the main problem.
@jaydalsaniya6986
@jaydalsaniya6986 3 жыл бұрын
Here Bottom Up Approach ko sikha ke , he has tried to explain that top down mein bhi vahi kara ja sakta hai .And this is top down only.
@atanupaul1490
@atanupaul1490 3 жыл бұрын
Best explation of 0-1 knapsack in youtube It helps me a lot..😊😊😊
@pruthvirajk6019
@pruthvirajk6019 4 жыл бұрын
Move on
@CompilationError
@CompilationError 4 жыл бұрын
lol.
@llliiilll3624
@llliiilll3624 4 жыл бұрын
Abdul Bari is a great person.
@yashjain9079
@yashjain9079 4 жыл бұрын
@@llliiilll3624 Ya Abdul Bari is great but not as great as him
@kaal_bhairav_24
@kaal_bhairav_24 4 жыл бұрын
Rachit's boasts justifies too : /
@RudraSingh-pb5ls
@RudraSingh-pb5ls 4 жыл бұрын
Well Gaurav sen doesn't boasts
@nehaburnwal5680
@nehaburnwal5680 4 жыл бұрын
Hey, very good and in-depth explanation. You seriously took 4 long videos to come to 0/1 knapsack tabulation solution. And to my surprise, they were very much helpful in understanding the concepts. It increases my base interest in dynamic programming. I must say that. Now I understand what lookup table means(used everywhere) that I previously used to confuse a lot in memoization. Thanks a lot!!! Just one suggestion, you please mention in the Introduction and in the Title of this video that it is bottom up approach(Tabulation) not top-down DP. No need to make another video or edit any videos. :D
@AshishTiwari-cr2uj
@AshishTiwari-cr2uj 4 жыл бұрын
I am one of those jinka "recursion hi strong nai h"
@deeproy7292
@deeproy7292 4 жыл бұрын
bhai karte rahe kosish geeks for geeks se backtracking ke questions kar...confidence aane lagega
@shubhamrana412
@shubhamrana412 4 жыл бұрын
Bro aditya bhaiya ki recursion playlist dekhlo fhir aapko for loop bekar lagne lag jayega
@deeproy7292
@deeproy7292 4 жыл бұрын
@@shubhamrana412 feeling same bhai
@sonulohani
@sonulohani 4 жыл бұрын
@@shubhamrana412 Lekin using for loop is better than using recursion.
@vikku_19
@vikku_19 3 жыл бұрын
@@sonulohani using a loop can be efficient? Btw what is the time complexity of the recursive function does it depend on the recurrence relation?
@AshishKumar-wb6hw
@AshishKumar-wb6hw 4 жыл бұрын
your effort is really appreciable. I have taken a class in many other platforms including code blocks that too by paying 20k but yes there was only one teacher in their platform who taught the same way you taught ..rest others mug up and deliver.
@akashgkrishnan9596
@akashgkrishnan9596 4 жыл бұрын
Recursion seekhlo DP Halwa lagegi . . . edit: ye kon bc dislike kar ra he
@SanthoshKumar-dh9zg
@SanthoshKumar-dh9zg 2 жыл бұрын
Hatsoff to your coding experience and joting down points to convert one method to another. Thanks for sharing these points.
@paramjeetsingh3444
@paramjeetsingh3444 Жыл бұрын
ur explanation is so well that even before seeing this video .. and understanding how DP works , i have solved 20 DP leetcode problems nd i am continuing series now .!
@harshit4190
@harshit4190 4 жыл бұрын
We don't watch videos here in channel, We watch playlists..Amazing content...
@084_sakshamgupta3
@084_sakshamgupta3 2 ай бұрын
i -> n and j -> w please take care of that, well explained thank bro
@saikatmukhopadhyay9733
@saikatmukhopadhyay9733 4 жыл бұрын
Best Dynamic programming series on KZbin
@shaikmohammedrafi3309
@shaikmohammedrafi3309 3 жыл бұрын
thanks a lot bro i am really loving the series.....I cant express how i am feeling after understanding everything
@afzalghani5499
@afzalghani5499 2 жыл бұрын
The best explanation of dp, Now I again have some confidence. I saw tons of video dp but this is the best.
@Shorts_n_Laughs
@Shorts_n_Laughs 2 жыл бұрын
He is teaching like he really cares for us... That line "bas tum recursive function acche se likh do mere bhai 🤍 20:40"
@shivsharma387
@shivsharma387 3 жыл бұрын
What the hell!! This is damn. I prepared for gate and just memorized the approach for different DP problem but from your explanation, I am to understand it thoroughly.. Bhai OP
6 Identification of Knapsack Problems and Introduction
6:17
Aditya Verma
Рет қаралды 282 М.
7 Subset Sum Problem
27:13
Aditya Verma
Рет қаралды 585 М.
Trapped by the Machine, Saved by Kind Strangers! #shorts
00:21
Fabiosa Best Lifehacks
Рет қаралды 33 МЛН
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 40 МЛН
PIZZA or CHICKEN // Left or Right Challenge
00:18
Hungry FAM
Рет қаралды 12 МЛН
Car Bubble vs Lamborghini
00:33
Stokes Twins
Рет қаралды 37 МЛН
10 Minimum Subset Sum Difference
46:41
Aditya Verma
Рет қаралды 393 М.
4 01Knapsack Memoization
13:53
Aditya Verma
Рет қаралды 499 М.
4.5 0/1 Knapsack - Two Methods - Dynamic Programming
28:24
Abdul Bari
Рет қаралды 2,8 МЛН
21  Longest common subsequence Top down DP
25:35
Aditya Verma
Рет қаралды 194 М.
Equal Sum Partition Problem
18:01
Aditya Verma
Рет қаралды 364 М.
2 Types of knapsack
13:50
Aditya Verma
Рет қаралды 493 М.
EASY MATH HACKS You Need to Know!!
12:16
infyGyan
Рет қаралды 334
3 01 Knapsack Recursive
21:04
Aditya Verma
Рет қаралды 615 М.
Trapped by the Machine, Saved by Kind Strangers! #shorts
00:21
Fabiosa Best Lifehacks
Рет қаралды 33 МЛН