6.2 Sum Of Subsets Problem - Backtracking

  Рет қаралды 1,355,235

Abdul Bari

Abdul Bari

6 жыл бұрын

Sum of Subsets problem
PATREON : www.patreon.com/bePatron?u=20...
Courses on Udemy
================
Java Programming
www.udemy.com/course/java-se-...
Data Structures using C and C++
www.udemy.com/course/datastru...
C++ Programming
www.udemy.com/course/cpp-deep...

Пікірлер: 418
@monishpidugu5134
@monishpidugu5134 3 жыл бұрын
Excellent sir I slept while my professor was teaching during my online classes but tomorrow I'm having my exam and I am watching your video's it was very helpful
@worldvieweye
@worldvieweye 2 жыл бұрын
👍🏻👍🏻
@srujangurram
@srujangurram 2 жыл бұрын
Same bro, hope you scored good in your exam
@monishpidugu5134
@monishpidugu5134 2 жыл бұрын
@@srujangurram yeah bro I scored 80 percent in my sem end examination
@srujangurram
@srujangurram 2 жыл бұрын
@@monishpidugu5134 that's awesome ! we have exam tomorrow. hope i does well too 🤞
@ingloriousmedia3096
@ingloriousmedia3096 2 жыл бұрын
I read I slept with my professor 🤣
@manish4275
@manish4275 5 жыл бұрын
Even my professor watches ur videos! If she forgets something we say her video is buffering 😂😂
@bharamberishikesh508
@bharamberishikesh508 5 жыл бұрын
My Professor Watches too but shortly explains algorithm 😂
@anupriyaranjan8966
@anupriyaranjan8966 5 жыл бұрын
You got me at "buffering" 😂😂
@karamchauhan7860
@karamchauhan7860 4 жыл бұрын
@@anupriyaranjan8966 Mam aap yaha 😄😀😄😀😄
@Randude14
@Randude14 4 жыл бұрын
DEAD
@ManishKumar-rz9ub
@ManishKumar-rz9ub 3 жыл бұрын
Possibly you will get the same question in the exam 😂😂
@ayounghosh9218
@ayounghosh9218 5 жыл бұрын
beautifully explained, amazingly clear videography, easily understandable hand writing, simple examples, clear simple English speech so that everyone can understand, slow paced speech so that anyone can grasp the concept, clear audio and the best part is the calm attitude of explanation, just everything that is needed for a perfect explanation, your channel has it.
@alexisxander817
@alexisxander817 6 жыл бұрын
You are such an amazing teacher; everything you explain is understood by me at once, and I am not even a meritorious student lol... thank you
@yashspr
@yashspr 6 жыл бұрын
I have never come across a better teacher than you sir. Hats off!
@XYZ-nz5gm
@XYZ-nz5gm 2 жыл бұрын
not many people can explain this well even though they understand inside out. You did a really good job!
@gnanajeyam6259
@gnanajeyam6259 3 жыл бұрын
The way you are explaining the recursion (DFS) is the unique skill you have. I appreciate your time for making this video's. Hope this will helps many people.
@kurru_kamiz3458
@kurru_kamiz3458 11 ай бұрын
does not sound like a compliment
@sumanthn5120
@sumanthn5120 10 ай бұрын
​@@kurru_kamiz3458why?it did sound like one
@f4lld4ark3
@f4lld4ark3 6 жыл бұрын
Best video professor, much hq quality, very nice kanimambo
@gaurav_jha
@gaurav_jha Жыл бұрын
Just brilliant, it's a privilege to have a teacher like you.
@Deepak-jk1eh
@Deepak-jk1eh 5 жыл бұрын
because of your videos i study only one night before of exam ,you r making every student life very easy by just giving these all videos in free ,so thanks you sir .
@NguyenTuan-ek1pv
@NguyenTuan-ek1pv 2 жыл бұрын
The best teacher ever on KZfaq. +1 vote!
@unscripted_india
@unscripted_india 6 жыл бұрын
Hit like if you have exams tomorrow and are watching this for end semester.
@Pankajkumar-dy9ef
@Pankajkumar-dy9ef 6 жыл бұрын
yes
@abhinavsharma8395
@abhinavsharma8395 5 жыл бұрын
yes bro
@rishiraj8416
@rishiraj8416 5 жыл бұрын
Hit like i have exam today 😂😂😂😂
@carlosgallegos1265
@carlosgallegos1265 5 жыл бұрын
If I watched this as my last resource the day before having an exam, I wouldn't pass anything. It's good to take a first glance, or to break apart a problem and solve it, but not as an academic foundation. Step up your game, don't be lazy.
@TheRegalstreak
@TheRegalstreak 5 жыл бұрын
@@carlosgallegos1265well it depends on person to person. I'm used to studying on the last minute and KZfaq videos are my last resort if I don't understand anything from books and Abdul Bari has been like a God to me literally. I wasn't much into algos and I'm really interested to get into this more. The teachers we have are too underpaid and are not as qualified as well as don't have their concepts clear some of the times. Having a community online helps us help one another and get info quickly without looking into 100s of pages lol.
@MBindu-kc2nj
@MBindu-kc2nj Жыл бұрын
Very helpful sir thank you. Initially I thought your videos are too lengthy but now I realized your way of teaching is the best.
@M-aggi-e
@M-aggi-e 6 жыл бұрын
By far the best explanation Sir. Thank you very much.
@droptimistic7419
@droptimistic7419 4 жыл бұрын
I was just misunderstanding of something and by seeing this great video all confusions became clear, thank you
@ahdibiaimene3588
@ahdibiaimene3588 2 жыл бұрын
You deserve all my respect sir , such a great teacher i wish you all the best
@adarshshenoy0623
@adarshshenoy0623 5 жыл бұрын
Thank you so much sir for your videos it ws too good and the way your explaining the concepts are not complicated . It helped me a lot thank you once again.
@surajkumar-px5lf
@surajkumar-px5lf Жыл бұрын
I don't go class because I know you will clear my all concept before exam. My teacher also made pdf from your lecture's screenshot. You are truly amazing. Sir
@michaelekoka3263
@michaelekoka3263 10 ай бұрын
This is an excellent explanation for the backtracking technique to solve this problem. An important precision about this approach, that is missing from the video and that may trip up or confuse the problem solver is that the *weights must be positive*. Without this precision, the bounding function doesn't make sense, since at the time we exceed the target sum during traversal, a later negative weight could bring it to target. So this backtracking approach works only if the weights are positive.
@jimmiejohnsson2272
@jimmiejohnsson2272 Жыл бұрын
Great explanation, good example and very easy to follow. I managed to implement and use this very quickly. Thanks a lot!
@codelearner3666
@codelearner3666 6 жыл бұрын
thank you so much, sir, your videos are really knowledgeable and helpful.
@bk5268
@bk5268 6 жыл бұрын
Tq u sir it is very useful me because tmr my daa exam tq u so much it is one of the my dout how to solve this but now i know how to subsititute
@rajmourya35
@rajmourya35 3 жыл бұрын
the way of teaching is so unique. awesome content sir.
@ShubhamKumar-wq9kw
@ShubhamKumar-wq9kw 6 жыл бұрын
content is good...including pseudocode explaination would be really helpful
@damansaroa
@damansaroa 4 жыл бұрын
+1
@subinaypanda9936
@subinaypanda9936 4 жыл бұрын
Sir have already explained how to solve the problem. Now it's your task of solving the whole problem.
@anaghaprabhu9293
@anaghaprabhu9293 6 жыл бұрын
I appreciate ur work sir. You are really amazing. .
@mekalasailatha8613
@mekalasailatha8613 4 жыл бұрын
It may be any tough sum,u make it easier by your explanation 😊
@marypulapa3743
@marypulapa3743 6 жыл бұрын
Sir outstanding explanation ... Sir really its easy to understand
@yashjamsandekar5173
@yashjamsandekar5173 7 ай бұрын
Thankyou so much sir !!!!! The way you explained was way more better than any teacher I've came across.
@rakshakedlaya8752
@rakshakedlaya8752 3 жыл бұрын
You explained it very well... This video helped me a lot...Thank you so much sir❤🙏
@arafatahmmed263
@arafatahmmed263 4 жыл бұрын
Thn...x for your explanation. Addition or discussion of time and space complexity will make you unique form others.
@aadarshkumayan5960
@aadarshkumayan5960 6 жыл бұрын
Very informative lecture series for starting with Backtracking
@FaKe-rq7cu
@FaKe-rq7cu 3 жыл бұрын
Very good explanation. I had a little doubt, at 8:18 shouldn't it be greater than or equal to 'm' instead of greater than 'm' in 2nd bounding function. Eg if arr = [1,2,3] & sum = 6, then after including 1 ( [1,5] ), the 2nd bounding function will not let it go further (even though taking all elements would have generated the sum).
@anuragjoshi667
@anuragjoshi667 3 жыл бұрын
Yeah, It seems so. Should have been ≥ m.
@mentisdominus
@mentisdominus 3 жыл бұрын
The 2nd bounding function is correct. It should be greater than m. You only apply the 2nd bounding function when descending down the right branch. When you descend down the right branch, it means that x[i]=0. In your example, after [1,5] and descending down the right branch x[2]=0 which means that 2 will not be included in the solution. The 2nd bounding function is telling you that you will not have enough values to reach the sum 'm' because the values going down the right branch will not be included in the solution. So for arr[1,2,3] and m=6, after taking 1 but not taking 2, you can't reach the value m=6.
@peksn
@peksn 3 жыл бұрын
No because if the rest of the weights can't add up to the number you are searching for then why continue? If the sum of your current sum plus the rest of the objects are less than that number then you'll never get it, so you stop.
@cswalker21
@cswalker21 4 жыл бұрын
Thanks Abdul! Very clear walkthrough of backtracking! It helped me greatly. LOL at the inconsequential arithmetic mistake at 6:39! ;) just shows you're human!
@vikasgoutam02
@vikasgoutam02 4 жыл бұрын
I also notice.
@ivandrofly
@ivandrofly 4 ай бұрын
yeah, noticed as well :D
@NIKHIL-nv8wu
@NIKHIL-nv8wu 5 жыл бұрын
Thank you sir for good video lecture,I can understand easily
@vinayaktulsian6276
@vinayaktulsian6276 6 жыл бұрын
Very nice sir thank you for helping us one day before our exam , you teach very well.
@GopiNath-pe3qz
@GopiNath-pe3qz 4 жыл бұрын
Alaguseriel Azagu
@bharatishinde7169
@bharatishinde7169 6 жыл бұрын
NICE METHODS AND WAY OF TEACHING
@-PriyankaReddy-tk5ti
@-PriyankaReddy-tk5ti 4 жыл бұрын
Seriously ... my professor given same example...I think she watches ur vedios 😂😂😂😅
@samudraladivya992
@samudraladivya992 3 жыл бұрын
Same 😅😅😅
@kingwillbeking3110
@kingwillbeking3110 3 жыл бұрын
Oh yeah, *Vedio.*
@BiswajitDas-lk7pp
@BiswajitDas-lk7pp Жыл бұрын
Same here also
@nikitamishra1126
@nikitamishra1126 3 ай бұрын
Ya same here..even my professor gave the same example🤭
@vinit173
@vinit173 3 ай бұрын
Same 😂
@chandukrishna4809
@chandukrishna4809 4 жыл бұрын
Thanks for the wonderful videos and It would be really helpful if you include writing code for this kind of DP, Back tracking Problems. May be, by watching your code, most people may get essence of "how to write code" for this kind of problems. My request is to include code for at least one problem of such type as including for all will be hectic.
@footballforyou8856
@footballforyou8856 6 жыл бұрын
Thanks a lot sir.good explanation.
@tng3100
@tng3100 Жыл бұрын
Just saw this video on morning of my sem exam for 4 min ,dayumm just helped a lot ,didn't expect they would ask this. Guess im so lucky afterall
@VipulDhaigude
@VipulDhaigude 4 жыл бұрын
Such simple and excellent explaination.
@saicharan8675
@saicharan8675 5 жыл бұрын
Hi Sir, Thanks for the very good explination
@gopikrishna1551
@gopikrishna1551 3 жыл бұрын
sir what is the time complexity for this problem? do we consider height as timecomplexity?
@himanshusingh3056
@himanshusingh3056 5 жыл бұрын
Superb Explanation for this problem !
@snigdhakasimahanthi3963
@snigdhakasimahanthi3963 2 жыл бұрын
Amazing explanation! Thank you very much!
@hitmandevil6935
@hitmandevil6935 5 жыл бұрын
Sir, the way you explain is actually great (it clears the concepts well). But I have a question, how to implement these solutions in a program, how to code these strategies with an efficient implementation. It would be very kind of you if you attach a link in the description (or make some more videos) stating the codes and what's the idea behind its efficient implementation. Thanks in advance....!!!
@visakh_vijayakumar_
@visakh_vijayakumar_ 6 жыл бұрын
thanks :) only suggestion is @ 6 : 40 it is 27 + 15 =42 ..
@francomartnlumovich4323
@francomartnlumovich4323 Жыл бұрын
Very good video. I want to add an improvement to this backtracking. You can add another bonding function, if w array is sorted ascending so X_(i-1) < X_i < X_(i+1) then you know if adding X_i is already greater than m then you kill the node and it's brothers because X_i+1 > X_i
@SahdevSingh-io3qp
@SahdevSingh-io3qp 6 ай бұрын
But sorting also takes some time O(nlogn) and here you are taking time to reduce time, which is meaningless
@mandilal94
@mandilal94 5 жыл бұрын
Excellent Teaching sir.Thank you
@ok123ut
@ok123ut 5 жыл бұрын
amazing explanation on this!
@bgminever7436
@bgminever7436 3 жыл бұрын
Sir u will get world's best teaching skills person🙏Award
@Nagasuhas_Shastry_M
@Nagasuhas_Shastry_M 5 жыл бұрын
Sir please make videos about other core computer science subjects Thank you sir great explanation
@rajanarasada2081
@rajanarasada2081 2 жыл бұрын
Super explanation sir I hope this explanation will make all queries clear
@c.danielpremkumar8495
@c.danielpremkumar8495 6 жыл бұрын
What if some of the weights/elements were to be negative ? Would it be different kind of problem altogether ?
@santaram4687
@santaram4687 6 жыл бұрын
Sir what is variable size tuple formation for solving sum of subsets using backtracking???
@pradeepalluri1195
@pradeepalluri1195 6 жыл бұрын
Very nice explanation sir
@itsupport8245
@itsupport8245 6 жыл бұрын
Sir, pls give us code with this problem..
@sankeerthreddy9865
@sankeerthreddy9865 6 жыл бұрын
Master of teaching😃
@sohaibanwaar5181
@sohaibanwaar5181 5 жыл бұрын
Great Work Sir! Thank you
@henryzhang2992
@henryzhang2992 4 жыл бұрын
The time complexity for this is still exponential. Consider the case where all of the elements are 1 and the last element is massive. If the target sum is less than the less element but more than all the other elements combined, no nodes are pruned
@SahdevSingh-io3qp
@SahdevSingh-io3qp 6 ай бұрын
See the second bounding condition, if the considered weight + total remaining weight is less than target sum, then no need to search further
@SahdevSingh-io3qp
@SahdevSingh-io3qp 6 ай бұрын
At first call, your example will be terminated
@fernandosanchezvillanueva4762
@fernandosanchezvillanueva4762 4 жыл бұрын
Save me the day!! I will see you on Udemy
@member828
@member828 4 жыл бұрын
I need to write a paper about the sum of subsets - backtracking, do you have any suggestions for good resources?
@captainsamar
@captainsamar 6 жыл бұрын
Very well explained Abdul
@vincentrastello720
@vincentrastello720 2 жыл бұрын
Great explanation, much better than my professor
@priyankarangarajan9336
@priyankarangarajan9336 4 жыл бұрын
You take class awesome sir mainly this subset class sir i learn subset sir👌👌👌
@relaxationmusic3535
@relaxationmusic3535 Жыл бұрын
what an explaination just outstanding thanku so much sir
@gsreddy2654
@gsreddy2654 5 жыл бұрын
Thank you sir that was really very helpful
@balajisolunke4482
@balajisolunke4482 8 ай бұрын
THANK YOU SIR , YOUR EXPLAINATION WAS SO EXCELLENT
@sepehrshahsavar9943
@sepehrshahsavar9943 4 жыл бұрын
thank you for your awesome tutorials sir , could you please make a video for monte carlo algorithm ?
@shilpapushparaj9988
@shilpapushparaj9988 6 жыл бұрын
Excellent teaching 😎😎
@anandbaskaran
@anandbaskaran 2 жыл бұрын
Quick question: If we just need one solution, I guess we should go for dynamic programming. But is it possible to give a quicker result there?
@abhishekdubey9268
@abhishekdubey9268 4 жыл бұрын
thank you sir , thank you sooo much sir .....my concept is completely cleared
@ItsmeBhanu.19
@ItsmeBhanu.19 3 жыл бұрын
wonderful teaching sir thank u so much
@RAGHUNATHSINGHBCI
@RAGHUNATHSINGHBCI Жыл бұрын
Thank you sir, I love your explaination😍 just one suggestion keep video time minimum for other video
@satyamgupta5234
@satyamgupta5234 2 жыл бұрын
Hats off||It helped me a lot thank you once again.
@abmsamsuzzaman4805
@abmsamsuzzaman4805 4 жыл бұрын
To understand the algorithm your videos are awesome. But I would suggest if you could please add the pseudocode at least while explaining the algorithm it would been more helpful.
@DhruvPatel-km8kj
@DhruvPatel-km8kj 6 жыл бұрын
Excellent work..
@irmachan1
@irmachan1 5 жыл бұрын
I love you man. thank you
@shubhamagarwal5693
@shubhamagarwal5693 4 жыл бұрын
Sir , can we use kadane's algirithm here by tweaking a bit as instead of checking for max sum , we can check with the sum given to us .? Please suggest ..
@FaranAiki
@FaranAiki Жыл бұрын
No, Sir, we cannot. That actually does not make any sense. Kadane's algorithm sees the sum as a whole, whereas this must be checked individually.
@shoaibshaik1507
@shoaibshaik1507 4 жыл бұрын
Mashallah Sir aap ki class superb...Ur teaching mind-blowing sir 👍
@abdul_bari
@abdul_bari 4 жыл бұрын
Thanks for liking
@santanu3633
@santanu3633 5 жыл бұрын
Thanks.... really nice explanation
@priyanshigupta1359
@priyanshigupta1359 3 жыл бұрын
best explanation ever , thanks sir
@luis-azanza
@luis-azanza 5 жыл бұрын
Amazing, thank you!!
@alfabinomial6183
@alfabinomial6183 4 жыл бұрын
wow !! so intelligent lecture !! sir
@darthvadar2915
@darthvadar2915 2 жыл бұрын
Hi sir, does this work for negative numbers as well
@vinitsunita
@vinitsunita 5 жыл бұрын
crisp and clear explaination
@sangeethamshare
@sangeethamshare 5 жыл бұрын
Sir, please publish a video for the same problem using DP. Thanks
@damilola_adegunwa
@damilola_adegunwa Жыл бұрын
are we allowed to remove redundant nodes, say if the node is more than the target (i.e. >30)?
@svarajdhanulkar1791
@svarajdhanulkar1791 4 жыл бұрын
Sir ji dhnayaavad bot thanku apkaa. Iss sem ka Daa aap hi nikalonge mera😊
@dheerajashishpreetham6812
@dheerajashishpreetham6812 3 жыл бұрын
How can the value of m remain 33 when we not including 4th object ie x4=0 i think the ans 27,46. correct me if im wrong
@Short_Talk_71
@Short_Talk_71 Жыл бұрын
Yes bro u are right. That's why i come to the comment section. I am sure any one student are done comment on this silly mistake.
@maxpayne7302
@maxpayne7302 3 ай бұрын
He does the same at 27,18 idk i think that is how you do it.
@numanali8545
@numanali8545 2 ай бұрын
He is just taking track of remaining weight to become 0, that's why he is decreasing regardless of including or excluding the element
@williamhogrider4136
@williamhogrider4136 Ай бұрын
The left part of the node is the sum of all the x you included until now but the right part is the sum of all the remaining x you can add, so the right part changes repeatedly no matter if you include the particular x or not. So when x4 is excluded, the remaining choices you have are just x5 and x6, so sum would be x5 + x6 = 15+18 = 33 not 46. So think of the right part as something that has the sum of the remaining elements after a level you're at. At level x2, the values is x3+x4+.... and at x3 it is x4+x5+.... .
@parthmota67
@parthmota67 5 жыл бұрын
congrats for 100k
@kakhilesh3866
@kakhilesh3866 4 жыл бұрын
Sir Can you explain tracing for sum of subsets algorithm
@anandkrishnan72
@anandkrishnan72 3 жыл бұрын
this only works if the given set is made of non-negative numbers right?
@battlefist6884
@battlefist6884 4 жыл бұрын
sir once came to our college , when i was in second year , hope once agian he will come to for gest lecture on DAA
@noorullahkhan7482
@noorullahkhan7482 5 жыл бұрын
Sir, please upload a video on sum of subsets using dynamic programming.
@pankajkumarprasad1489
@pankajkumarprasad1489 4 жыл бұрын
Best explanation ever 😊
@droptimistic7419
@droptimistic7419 4 жыл бұрын
thank you , your explanation really great, can we use visited array rather than including and excluding? and do you have any link to see how we can programme it .
@kiranmallikarjun8618
@kiranmallikarjun8618 5 жыл бұрын
I have a doubt on that we did not include some items so that y u reduce the total weight from where we did not consider that item
@amirawaheed3714
@amirawaheed3714 2 жыл бұрын
Many many thanks, i understanded it very well
@yizhang7027
@yizhang7027 2 жыл бұрын
State-space tree is such an amazing tool. Why haven't I heard about it earlier?
6.3 Graph Coloring Problem - Backtracking
15:52
Abdul Bari
Рет қаралды 1,1 МЛН
6.1 N Queens Problem using Backtracking
13:41
Abdul Bari
Рет қаралды 1,9 МЛН
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 29 МЛН
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 10 МЛН
7.3 Traveling Salesman Problem - Branch and Bound
24:42
Abdul Bari
Рет қаралды 1,7 МЛН
Germany | Can you solve this ? | Math Olympiad  (x,y)=?
11:02
Learncommunolizer
Рет қаралды 21 М.
if Technoblade joined Parkour Civilization
4:19
Electy
Рет қаралды 11 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Sum Of Subsets Problem in Back Tracking - Method, Example |L-13||DAA|
11:33