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).
@TheAdityaVerma4 жыл бұрын
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-gupta4 жыл бұрын
@@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. :)
@deepamgupta80114 жыл бұрын
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_mark11074 жыл бұрын
@@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??
@saurabhmarpadge74984 жыл бұрын
@@stark_mark1107 Ya exactly.
@snehilsinha46893 жыл бұрын
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Ай бұрын
they aren't trash btw
@kritikatripathi8064 жыл бұрын
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.
@TheAdityaVerma4 жыл бұрын
Glad it helped you !! Please consider sharing the content with your friends or college to help this channel grow !!
@ankushroy9194 жыл бұрын
@@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-stevegjffuhdry3 жыл бұрын
@@TheAdityaVerma will definitely! keep on posting, love the vids
@buzzfeedRED3 жыл бұрын
@@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.
@ankitbhardwaj73633 жыл бұрын
@@buzzfeedRED 0/1 knapsack or unbounded knapsack ?
@nehaagarwalla9004 Жыл бұрын
Bro I am a 15 years experience engineer.. your explanation and determination to make everyone understand this topic hits hard
@muditkhanna816411 ай бұрын
after 15 years why are you here for dp tutorials. i mean dp is basically caching. you might've already knew that.
@yasirmalik19810 ай бұрын
@@muditkhanna8164 YOE?
@pranavJha93Ай бұрын
@@muditkhanna8164 let her learn bro
@capone26763 жыл бұрын
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.
@vibhuagwl4 жыл бұрын
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.
@TheAdityaVerma4 жыл бұрын
Thanks a lot brother !! I am glad you liked it !!
@coolbuddy83864 жыл бұрын
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.
@damercy4 жыл бұрын
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! ✌️💯
@yogeshyts3 жыл бұрын
placement hui ky?
@damercy3 жыл бұрын
@@yogeshyts Haan bhai, 10LPA
@yogeshyts3 жыл бұрын
@@damercy company?
@damercy3 жыл бұрын
@@yogeshyts It's an early stage startup man. :)
@damercy3 жыл бұрын
@Adarsh Chaurasia Hey thanks! :)
@BHARATKUMAR-dk1ij3 жыл бұрын
First time i have seen someone connecting recursive code and tabular code like this, your method of teaching is just amazing.
@shubhanshusaxena12324 жыл бұрын
this is called as TEACHING Dynamic Programming!! great work Aditya! :)
@ClassyKSC4 жыл бұрын
Didn't realize the 40 minutes were over till you said that "ab aapko samjh aa gaya hoga". That's how well you taught.
@jameysiddiqui69104 жыл бұрын
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]]
@ankitmishraR3 жыл бұрын
yes exactly
@klbamniya3 жыл бұрын
Agreed
@bokkamanideep98933 жыл бұрын
Why taking dp[n+1][w+1] for what that +1 please resolve my doubt
@balvindersingh13293 жыл бұрын
@@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
@prateekmadan69362 жыл бұрын
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?
@kush-cp8kc2 жыл бұрын
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 .
@ramankumar98564 жыл бұрын
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
@amitray7692 ай бұрын
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.
@arindamdas34643 жыл бұрын
Hands down the best explanation on DP. You are helping those who cant afford to join expensive courses online. Keep it up brother !! Thanks !!
@jayparekh19923 жыл бұрын
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.
@JyotiSharma-dm8ls3 жыл бұрын
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.
@jasmeen25414 жыл бұрын
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 ❤
@Learner0104 жыл бұрын
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
@devanshmesson27774 жыл бұрын
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!
@himanshugupta70103 жыл бұрын
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
@wholeegg4 жыл бұрын
One day I'll succeed in spinning pen like you.
@meenalagarwal45164 жыл бұрын
it took me entire 11th and 12th XD
@blasttrash4 жыл бұрын
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-rr6te4 жыл бұрын
practice jaari hai bhai
@0anant04 жыл бұрын
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?
@amansinghgautam95784 жыл бұрын
@@0anant0 you can spin any pen lol
@MegaDeepak566 ай бұрын
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.
@shresthgupta26703 ай бұрын
yes buddy yuo are right
@agarwalaadi993 жыл бұрын
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 !!
@AlbertoRodriguez-oe6jo3 жыл бұрын
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 Жыл бұрын
In Memoization why your code is giving the wrong input when the vector t is declared globally?
@the_only_one9415 Жыл бұрын
is'nt it v[i] intead of v[i-1]
@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 Жыл бұрын
Can I please know why we require second else? when in If only we have the same statement?
@kalagaarun96384 жыл бұрын
pehli baar top down ka matrix bana ke use kata nhi 😅😅 kudos to your effort, sir !! 🙌🙌
@sreeramsuresh8947 Жыл бұрын
The best among the ones which exist...Explaining such a hard topic in a very simple manner. Hats off
@blue_jerry4 жыл бұрын
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]].
@ankitsagar83794 жыл бұрын
Rasik Mahajan was waiting for this comment
@vritansh144 жыл бұрын
correct! Got me confused. Now it's all clear
@tomy74244 жыл бұрын
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.
@0anant04 жыл бұрын
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?
@saketsrivastava49533 жыл бұрын
I was searching for this comment , I was confused too -_-
@kingrajput62023 жыл бұрын
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
@mohitsoni43523 жыл бұрын
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.
@ujwalsingh26363 жыл бұрын
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🙏
@lakshmisravyaharivanam60454 жыл бұрын
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 !!!
@karanmistry30184 жыл бұрын
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 🙂
@aryanyadav39262 жыл бұрын
The amount of efforts put in explanation is commendable! Thanks a lot sir!
@vijaychander21774 жыл бұрын
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
@debbh2744 жыл бұрын
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.
@TheAdityaVerma4 жыл бұрын
Thanks a lot for such a great comment brother. You made my day !! ❤️ Do share !!
@kraj22179 ай бұрын
Thanks!
@TheAdityaVerma9 ай бұрын
Thanks for watching
@mastermind821344 жыл бұрын
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 : ).
@sarthakpal82314 жыл бұрын
that hostel point was so damn relatable xD
@mrsukki81584 жыл бұрын
He is dead bro 😭
@AbhishekKumar-im2xd4 жыл бұрын
@@mrsukki8158 stop spamming fake news
@Aks-473 жыл бұрын
@@mrsukki8158 tera baap hoga, aditya verma nahi
@shaikfahim12323 жыл бұрын
@@mrsukki8158 aisa nahi hosakta
@kumardivyanshu73273 жыл бұрын
Finally, I understood the lines of code. Earlier, I was getting an error. Thanks!
@tushargarg63594 жыл бұрын
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?
@akhilk51214 жыл бұрын
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.
@vijaypalmanit3 жыл бұрын
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.
@praveenchouhan63884 жыл бұрын
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.............
@devrajsinghshekhawat66174 жыл бұрын
Fadd explanation hai bro.Your concepts are crystal clear, recursion par bhi playlist upload krdo brother
@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
@satyamabhishek13173 жыл бұрын
best DP explanation till date either on free platform or on paid courses. :)
@pavanala22004 жыл бұрын
One of the Best dynamic programming course.. ever❤️❤️
@yashsharma61122 жыл бұрын
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
@llliiilll36244 жыл бұрын
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-Sharma14 жыл бұрын
haa but woh abhi main nahi hai bhai, main hai yeh DP😂😂
@daisychain80113 жыл бұрын
You're 100% correct though the rest of the algo is O(n*w) anyway so it doesn't really matter Asymptomatically
@sanjayjoshi88073 жыл бұрын
bro does it matter if I write outer loop for W and inner loop for N ???
@jaydalsaniya69863 жыл бұрын
Ab ate hai yeh log , jo padhane vale k samne usko sikhate hai .
@amishasingh46063 жыл бұрын
kuch bhi...isse khaali 1st row and 1st column hi initialise hoga
@immrhrr4 ай бұрын
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
@ajayraj13 жыл бұрын
This is Epic 🙌, thanks alot sir for this
@vivekverma40124 жыл бұрын
i switched to your next video but suddenly i realised that i need to say thanku for your amazing explanation and great efforts.
@suvam2perfect4 жыл бұрын
You madee brave enough to encounter Algorithm and coding ❤️
@pratikjain33233 жыл бұрын
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!
@PritamKarmakar4 жыл бұрын
Amazing bro, so easy to follow. Keep rocking. Felt like I'm in my college days, some of my topper guys explaining me :)
@ramyaneekashyap14672 жыл бұрын
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
@purandarparitosh4 жыл бұрын
just one word bhaiya, just one: BRILLIANT!!!!
@manishbolbanda98723 жыл бұрын
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.
@curiosity98614 жыл бұрын
Everything u taught in this video is on point love it🔥🔥🔥🔥.
@Shorts_n_Laughs2 жыл бұрын
He is teaching like he really cares for us... That line "bas tum recursive function acche se likh do mere bhai 🤍 20:40"
@gandharavkatyal8224 жыл бұрын
Hi bro, Great initiative. Please make videos on graphs as well :) It will be a great help.
@varungoel69813 жыл бұрын
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 :)
@suvodeeepbiswas63604 жыл бұрын
We are just awesome ..Lot of respect and lot of love to you sir❤️
@SushilYadav74 жыл бұрын
ME Wayne We?🤣
@suvodeeepbiswas63604 жыл бұрын
I mean u sir
@hiteshsondhi2 жыл бұрын
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
@jainlokesh3184 жыл бұрын
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 :)
@TheAdityaVerma4 жыл бұрын
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 !! ✌️❤️
@abhishekmohanty2324 жыл бұрын
bhai kya he bolu .majja he aaaa gaya ,10 times batter than college professors. recursion sikhane ke kiye eek video series bana do pls.
@TheAdityaVerma4 жыл бұрын
Thanks brother, Do subscribe and share, that keeps me motivated to do more !! and yeah its in my to-do list.
@vivekagarwal48533 жыл бұрын
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]'.
@komaldeepsingh63563 жыл бұрын
Yes... I also noticed same
@kirtikhohal33132 жыл бұрын
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.
@amberkumar23593 жыл бұрын
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.
@akshatjain68544 жыл бұрын
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
@SunirbanVlogs2 жыл бұрын
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
@Ji-yoon4 жыл бұрын
Thanku so much for this amazing lecture.......!!!!!!
@sayantandas994 жыл бұрын
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! :)
@GAURAVSINGH-hu3qp4 жыл бұрын
bro ur just too good
@TheAdityaVerma4 жыл бұрын
Thanks brother, share to help this channel grow !!
@spandanarangaswamy6443 Жыл бұрын
This explanation is tremendous . I wish I had found this earlier!!!.Please post more and more videos!!!!
@anirudhlok20474 жыл бұрын
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]
@sreeraghuvardhanvangipuram95472 жыл бұрын
Did you figure it out? If yes can you reply with an answer.. I have the same doubt
@anudeepkollapudi38154 күн бұрын
Hi Anirudh, what you said is absolutely true. It doesn't make sense. The explanation is pretty bad imo. Not sure why people are praising a lot. There are much better videos on bottom up approach. Just see them and leave this video. This is like trying to memorising stuff without logic imo.
@maniyadav32562 жыл бұрын
bhai aap ka 41 min is equivalent to my 3hours, because you are amazing DSA teacher,
@amitgohri16224 жыл бұрын
aren't you mistaking iterative solution saying it top-down which rather should be bottom-up ?
@atanupaul14904 жыл бұрын
Best explation of 0-1 knapsack in youtube It helps me a lot..😊😊😊
@muskangoel8974 жыл бұрын
Is there any specific reason you took t[n+1][w+1] and not t[w+1][n+1]?
@TheAdityaVerma4 жыл бұрын
No, Other way around will work too !!
@travellingsLenses3 жыл бұрын
Bhai, itni clarity se samjhaya hai ki DP se pyar ho gya :D
@tusharnain66522 жыл бұрын
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-lx9rh2 жыл бұрын
Thank yoooooou soo much for the code 😭
@afzalghani54992 жыл бұрын
The best explanation of dp, Now I again have some confidence. I saw tons of video dp but this is the best.
@joshiadvait84 жыл бұрын
Bhai recursion sikha do acche se ek bari....... fir DP halwaa lagegi
@TheAdityaVerma4 жыл бұрын
Will be uploading more videos in may till then keep sharing to help this channel grow + thats motivates me to make more videos !! ❤️✌️
@anikettatte74084 жыл бұрын
@@TheAdityaVerma Bhaiya ..in desperate need of a playlist on Recursion..!! Love your work
@ritiksingh-dq2gs4 жыл бұрын
Make video on dp for grid
@nehaburnwal56804 жыл бұрын
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
@vishalchincholi44904 жыл бұрын
THIS VIDEO SHOULD BE RE-TITLED AS "BOTTOM UP APPROACH" WHICH IS TABULATION.
@Ganeshsp14 жыл бұрын
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.
@jaydalsaniya69863 жыл бұрын
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.
@noobichesser94343 жыл бұрын
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.
@AshishTiwari-cr2uj4 жыл бұрын
I am one of those jinka "recursion hi strong nai h"
@deeproy72924 жыл бұрын
bhai karte rahe kosish geeks for geeks se backtracking ke questions kar...confidence aane lagega
@shubhamrana4124 жыл бұрын
Bro aditya bhaiya ki recursion playlist dekhlo fhir aapko for loop bekar lagne lag jayega
@deeproy72924 жыл бұрын
@@shubhamrana412 feeling same bhai
@sonulohani4 жыл бұрын
@@shubhamrana412 Lekin using for loop is better than using recursion.
@vikku_193 жыл бұрын
@@sonulohani using a loop can be efficient? Btw what is the time complexity of the recursive function does it depend on the recurrence relation?
@harshit41904 жыл бұрын
We don't watch videos here in channel, We watch playlists..Amazing content...
@pruthvirajk60194 жыл бұрын
Move on
@CompilationError4 жыл бұрын
lol.
@llliiilll36244 жыл бұрын
Abdul Bari is a great person.
@yashjain90794 жыл бұрын
@@llliiilll3624 Ya Abdul Bari is great but not as great as him
@kaal_bhairav_244 жыл бұрын
Rachit's boasts justifies too : /
@RudraSingh-pb5ls4 жыл бұрын
Well Gaurav sen doesn't boasts
@sushmitagoswami20332 жыл бұрын
Other paid EdTech providers please dekho inko.. Nobody can explain this way! Hats Off Bro!
@akashgkrishnan95964 жыл бұрын
Recursion seekhlo DP Halwa lagegi . . . edit: ye kon bc dislike kar ra he
@SanthoshKumar-dh9zg2 жыл бұрын
Hatsoff to your coding experience and joting down points to convert one method to another. Thanks for sharing these points.
@shaikmohammedrafi33093 жыл бұрын
thanks a lot bro i am really loving the series.....I cant express how i am feeling after understanding everything
@divyarajsinhpadhiyar44428 ай бұрын
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.....
@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 .!
@samratmukherjee71312 ай бұрын
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.
@murtuzashareef79064 жыл бұрын
200% right. Nobody could explain like this. Hats off to you man!!
@shivsharma3873 жыл бұрын
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
@saikatmukhopadhyay97334 жыл бұрын
Best Dynamic programming series on KZbin
@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[][].