Visualisation is important in DP Problems. it's important to understand the basics before diving into complex problems. Otherwise you might get stuck somewhere. I will strongly recommend you to watch the FULL video. Do not skip parts to fully grasp the concept. I've tried to visualise this problem in 3 different ways. You can use any of these ways to visualise your next DP problem.
Bhaiya finally apka video aa gya..,, thanks bhaiya,,.. DP should be the first priority if someone wants to get into a good company and also ek acha project... Harr exam mei ek dp ka question mill hi jata hai... Or ek maths pe or ek graph ya kisi or algorithm pe
your explanation is truly Amazing ! , I have seen 3-4 videos on dynamic programming for the same problem ( as I have started only with dp concepts )but was not getting proper insights on why (?) we are doing the things. But you explanation helped me sail through this. Thnx a lot for this useful content.
bhaiya bhaut bhaut shukriya kl s try kr rahi pr iska dp soln smj nahi arra h ....kuki iske memoization part kiya to usme sari values fill nahi ho rahi h thi to smj na aya ......apne achee s btaya h bdia thank u bhaiya
Bhaiyya yesterday I had my practical, and external got extremely impressed when I explained him this entire problem using dynamic programming. I want to say a big THANK YOU!! to you..❤
i think most of people dont face problem in understanding concept. Main problem is regarding coding and that is not convered in this. theoritically its easy to understand but without coding it is incomplete. Coding and explaining parallely will be helpful. Thank You.
Totally disagree! If you have a clear logic you can code easily! The problem almost all students face during coding rounds is that they don't have the theoretical logic clear and hence can't code! I don't see any difficulty if you have a clear concept in mind! As such how difficult would it be to code using simple if else while for etc!
Your explanation is truly amazing ... I was struggling in learning dp from 2days but after seeing your video i got crystal clear about the concept ! Thanks a lot !!❤✨
Bhaiya kuch aur DP problems explain krdo......please.....aur ye bol dijiye ye Recursive style DP k solutions kahan se milenge agar solve nhi horha toh.
@anuj bhaiya ,please java, DS and algo. Wala course pura karwado, bich m rh gya ,bhut hope hai bhai, please please please please please and ak full stack developer ke lie complete guide ka video bnao , youtube pe bahut h lekin anuj bhiya ak hi h humare, java ka sab kuch clear hogya apka wo series se so please ak video java full stack pe, complete guide...
If the concepts are clear in the beginning then you can solve Hard problems with ease. Sure, I'll be making more videos on hard problems too but let's start with easy problems first and make our basic concepts stronger.
I had question... is this course in continuation to your earlier course of java?? because I am just about to start coding and i love the way you teach... pls reply :)
Hi, if I visualize this tree like that in coin change problem, will it be the same thing? And if yes, then how do we find time complexity in the case without DP as tree will have 4 branches?
Thanks a lot bhaiya - one quick question please, how 6(3) and other 6(3) is same overlapping problem? In first 6(3) -> value is 10 as we took [0, 0, 4] weights In second 6(3) -> value is 50 as we took [1, 3, 0] weights More over the output of both sub-problem will also be different In first 6(3) output will be -> 60 as we will take [0, 0, 4, 6] weights In second 6(3) output will be -> 110 as we will take [1, ,3, 0, 6] weights Am I wrong here? Also, I know some where down the line it has over-lapping sub-problems but I can't really figure that out, exactly where?
Hi Anuj, Could you pls relate tree with this table My friend and I got table visualization but not two important things... 1- > how to do conversion from tree (recursion) to memoization and 2. Not clearly choosing of dimension of array.. I am thinking these two Important things but unfortunately nobody telling these important things or might educators are not taking these parts seriously
Bhaiya, I am new to hackerRank and I am able to do easy and medium difficulty level questions. My question is what is the difficulty level of coding round questions of product based companies ? Plz guide me so that I can set a goal....hackerrank has “easy...medium...hard..advance...expert” level questions...
Bhaiya i understood the ques But i had one doubt Isme humne 2d matrix liya but 0-N knapsack bhi similar kind of ques but usse hum 1d dp se solve karte h Aisa kyu ?
Ye wala doubt hamesha hi rhta hai 😅. Recursive kare ya loops se kare. But if you think enough, DP is essentially just saving the previous result in memory. Now this memory can contain this data in any form - Array/Map/Matrix. In the end what matters is how you find the subproblems and identify the relation between them. So, You can choose any approach Recursive or Iterative, it's upto you.
Visualisation is important in DP Problems.
it's important to understand the basics before diving into complex problems. Otherwise you might get stuck somewhere. I will strongly recommend you to watch the FULL video. Do not skip parts to fully grasp the concept. I've tried to visualise this problem in 3 different ways. You can use any of these ways to visualise your next DP problem.
Bhaiyaa Android ka course continue rakhna. 😊😍
Bhaiya finally apka video aa gya..,, thanks bhaiya,,.. DP should be the first priority if someone wants to get into a good company and also ek acha project...
Harr exam mei ek dp ka question mill hi jata hai... Or ek maths pe or ek graph ya kisi or algorithm pe
Bhaiya dsAlgo thoda jaldi jaldi cover kariye if possible.
And bhaiya video lambi hona doesn't matter app please code bhi kar k samjha diya kro!!!
Bhaiya meri abi placements start ho gyi hai ap please yeh ds algo course jald se jald complete kar do
Ha bhaiya *ds algo* pe interview materials bata dijiye pleaseeeeeee 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Best Video ever on 0/1 Knapsack problem which clear all doubts. Thanks, Man.
Thanks a lot bhaiya . Huge support to this channel , was waiting for this course from the time I subscribed this channel.
Bhaiya please Android development ka course continue rakhna....bohot help hoga humlogo k liye ......love you vaiya♥️♥️♥️
Kyu sab free chahiye kya ? Thoda pay bhi kro...
@@ytg6663 TH-cam is paying na , all we want is free quality content
@@JamesBond-bi2cr 🙄
your explanation is truly Amazing ! , I have seen 3-4 videos on dynamic programming for the same problem ( as I have started only with dp concepts )but was not getting proper insights on why (?) we are doing the things.
But you explanation helped me sail through this.
Thnx a lot for this useful content.
Please DS+ALGO complete krwa do please 🙏(in java)
Easy Code I did myself...thanks for the easy explanation Bhaiya!
Attaching the code for reference:
public class KnapsackProblem {
public static void main(String[] args) {
int capacity = 10;
int[] w = new int[]{1,3,4,6};
int[] v = new int[]{20,30,10,50};
solve(capacity,w,v);
}
static void solve(int capacity, int[] w, int[] v){
int[][] mat = new int[w.length+1][capacity+1];
for(int i=1;ij){
mat[i][j] = mat[i-1][j];
}else {
mat[i][j] = findMax(mat,v,w,i,j);
}
}
}
}
findWeights(mat,w,v,capacity);
for (int i=0;i< mat.length;i++){
for(int j=0;j0 && i>0 && j>0){
if(mat[i][j] == mat[i-1][j]){
i-=1;
}else {
ans.add(v[i-1]);
capacity = capacity-w[i-1];
for(int index = 0;index< w.length;index++){
if(w[index]==capacity){
i = index+1;
}
}
j=capacity;
}
}
System.out.println("Total item == "+ans);
}
static int findMax(int[][] mat,int[] v,int[] w, int i,int j){
int diffVal = 0;
int diff = j-w[i-1];
if(diff
Many tutors just explain the text and are unable to create visualization like you did. Thank you.
bhaiya bhaut bhaut shukriya kl s try kr rahi pr iska dp soln smj nahi arra h ....kuki iske memoization part kiya to usme sari values fill nahi ho rahi h thi to smj na aya ......apne achee s btaya h bdia thank u bhaiya
Just solved this problem after your explanation. Such a well-explained video. RESPECT++;
Thanks a lot bhaiya !😃
Your videos help us understand the concepts very well.
Thanks a lot of bhaiya for making the study so easy I have no word for your praises 🙏🙏🙏
Finally sare jagah se kuchh na kuchh sikha phir aya apke lecture ko,khud hi complete code v likh liya ab to.means mehnat rang layi❤️❤️
Bhaiyya yesterday I had my practical, and external got extremely impressed when I explained him this entire problem using dynamic programming. I want to say a big THANK YOU!! to you..❤
awesome video thankyou for clearing my concepts bhaiya
Best explanation thanks a lot
i think most of people dont face problem in understanding concept. Main problem is regarding coding and that is not convered in this. theoritically its easy to understand but without coding it is incomplete. Coding and explaining parallely will be helpful. Thank You.
Totally disagree! If you have a clear logic you can code easily! The problem almost all students face during coding rounds is that they don't have the theoretical logic clear and hence can't code! I don't see any difficulty if you have a clear concept in mind! As such how difficult would it be to code using simple if else while for etc!
excellent sir good job
Aap sabse best pdhate ho...ds + java..wo complete karwa do please..bahut request hai bhaiya
Thank you soo much bhaiya. Because of you I am able to solve dp problemns.
The best video ever made on 01 knapsack hands down best video ever. straight to the point ❤❤❤
Great explanation and great work for community . Thanks a lot !!!
Your explanation is truly amazing ...
I was struggling in learning dp from 2days but after seeing your video i got crystal clear about the concept !
Thanks a lot !!❤✨
Bhaiya.. please make full complete lectures on data structures and algorithms.. The way u explain is fantastic..
every tutor just simply explained how to do but you explained why ? + how? to do
Best explanation of dp in the internet ❤️
Thank you anuj bhai❤️
Best video , way better than that TUSHAR!!!
sab jagha dekh liya kahi samjh nahi aaya kaash pahle hi mil jata ye channel bdiya padate ho aap sir
bhaiya meri g*nd ftgi thii iss dynamic programming topic m pr aapne bhot OP smjha dia. Thanks a lot, Huge respect.❤❤
Ohhh...Now I think I finally know DP..thank u bhaiyya...had been struggling since so long
Bhaiya aapka explanation khatarnaaak haiiii.......Best DP teacher aap ho bhaiya.......
Thanks bro
mast bataya hai
Bhaiya kuch aur DP problems explain krdo......please.....aur ye bol dijiye ye Recursive style DP k solutions kahan se milenge agar solve nhi horha toh.
Bhaiya Unbounded Knapsack, MCM ko bhi cover kar dena... BTW Great Video 👍
It's very good explanation 😎👌👌
With a very good example beautifully explained man .. Awesome 👍
@anuj bhaiya ,please java, DS and algo. Wala course pura karwado, bich m rh gya ,bhut hope hai bhai, please please please please please and
ak full stack developer ke lie complete guide ka video bnao , youtube pe bahut h lekin anuj bhiya ak hi h humare, java ka sab kuch clear hogya apka wo series se so please ak video java full stack pe, complete guide...
great explanation👏
you're awesome sir
thank you so much for this. The visualization is excellent
Bhai ur videos r awesome 😎, please keep bringing more content on dp.🙏
perfect
explanation
best explanation
Thank you so much bhai for starting dp too 😊😊😊😊😊😊
Best DP videoes on whole youtube...
Thanks bhaiya for this🙏🙏🙏
Please make a video on burst balloon problem too, if possible. :)
baiya dynamic programming pe aur video lana
the videos are very good and helpful
Great video
Beautifully Explained :)
Thank you sir.
Bhaiya thanks for this video....But please make videos on hard problems of graph such as snake and ladder etc.
If the concepts are clear in the beginning then you can solve Hard problems with ease. Sure, I'll be making more videos on hard problems too but let's start with easy problems first and make our basic concepts stronger.
Looking awesome 😀😀
liked the explanation.
I had question... is this course in continuation to your earlier course of java?? because I am just about to start coding and i love the way you teach... pls reply :)
Thanks a lot
#salute
Thanks
Apki java ka Mai Sabhi Videos dekha hu, project ko kaise bnau, beginner ke liye plz bhaiya
🙏🙏
Bhaiya what is java.lang.StackOverflowError
Please bhaiya make complete series on all Algorithms and CP.
The Efforts!!!🔥🔥
Thank you so much for thjs video
thank you sir for explaining table in such simple manner
Amazing explanation!
Bhaiya cmplt algo ki series banaao plzzz from start to end
Kadak
Bhaiya, Java language par #Project bta dijiye please,
Bhaiya dp ki series bhut achi bn rhi hai please isko bnate rahiyega
Hi, if I visualize this tree like that in coin change problem, will it be the same thing? And if yes, then how do we find time complexity in the case without DP as tree will have 4 branches?
Thanks a lot bhaiya - one quick question please, how 6(3) and other 6(3) is same overlapping problem?
In first 6(3) -> value is 10 as we took [0, 0, 4] weights
In second 6(3) -> value is 50 as we took [1, 3, 0] weights
More over the output of both sub-problem will also be different
In first 6(3) output will be -> 60 as we will take [0, 0, 4, 6] weights
In second 6(3) output will be -> 110 as we will take [1, ,3, 0, 6] weights
Am I wrong here?
Also, I know some where down the line it has over-lapping sub-problems but I can't really figure that out, exactly where?
Pls make a video on how to install ubuntu for competitive programming
Best dry run !
Coolllll
Bhaiya android development ki next khab ha rhi hai??
Hi Anuj,
Could you pls relate tree with this table My friend and I got table visualization but not two important things... 1- > how to do conversion from tree (recursion) to memoization and 2. Not clearly choosing of dimension of array.. I am thinking these two Important things but unfortunately nobody telling these important things or might educators are not taking these parts seriously
As compare to other q bhaiya isme bhaut kam repetation hota h dp or recursion m jyada frk nahi ayega agr isko explore krenge example s
Sir java socket ki series bnao please
as u completed java course on apni kaksha in that way pls continue android playlist also thankyou
Bhaiya please complete DS and ALGORITHM 🙏🏻🙏🏻
It’s better if you write the code with explanation
What about in case of multiple items with same weights
Bhaiya, I am new to hackerRank and I am able to do easy and medium difficulty level questions. My question is what is the difficulty level of coding round questions of product based companies ? Plz guide me so that I can set a goal....hackerrank has “easy...medium...hard..advance...expert” level questions...
thanku bhiya asee ds algo pe videos lao
make a video on knapsack 2 also
Bhaiya placement insight plz batao
Android series ka alga project✨
bhaiya can you made more video on dp
Bhaiya i understood the ques
But i had one doubt
Isme humne 2d matrix liya but 0-N knapsack bhi similar kind of ques but usse hum 1d dp se solve karte h
Aisa kyu ?
Bhaiya, make one telegram channel as well.
Sir,
Bhai please make video on full stack android development 🙏🙏
Please guide us which books to refer
if we are able to pick one item more times.then what will be the changes in the code or logic
Bhaiya dp tabulation wali bhi sike ya recursive se kaam chaljega
Ye wala doubt hamesha hi rhta hai 😅. Recursive kare ya loops se kare. But if you think enough, DP is essentially just saving the previous result in memory. Now this memory can contain this data in any form - Array/Map/Matrix.
In the end what matters is how you find the subproblems and identify the relation between them. So, You can choose any approach Recursive or Iterative, it's upto you.
Bhaiya, Android development k liye ds and algo important h kya??
Algo ka use nai hai...DS aur oopm ka use hai bohot
@@yoyo516 thx bro
@@ujjawalkumar9214 ✌️
code---> int knapSack(int W, int wt[], int val[], int n)
{
vectordp(n+1 , vector(W+1 , 0));
for(int i=1 ; i
bhaiya ek naya java placement course start kro....plz🙏🙏🙏🙏 or suggest something on any paid platform...... plz bhaiya
bhai ya vo apni kaksha me java ka course complete karo na es chennal me