Subset Sum Problem using Dynamic Programming | Data Structures and Algorithms

  Рет қаралды 179,127

Jenny's Lectures CS IT

Jenny's Lectures CS IT

5 жыл бұрын

Learn how to solve sunset sum problem using dynamic programming approach.
Data structures and algorithms playlist link:
/ @jennyslecturescsit
Jenny’s Lectures CS/IT NET&JRF is a Free KZbin Channel providing Computer Science / Information Technology / Computer-related tutorials including Programming Tutorials, NET & JRF Coaching Videos, Algorithms, GATE Coaching Videos, UGC NET, NTA NET, JRF, BTech, MTech, Ph.D., tips and other helpful videos for Computer Science / Information Technology students to advanced tech theory and computer science lectures, Teaching Computer Science in Informal Space. Learning to teach computer scienceoutside the classroom….
KZbin a top choice for users that want to learn computer programming, but don't have the money or the time to go through a complete college/ Institute / Coaching Centre course. ... Jenny’s Lectures CS/IT NET&JRF is aFree KZbin Channel providing computer-related ... and educate students in science, technology and other subjects.
If you have any further questions, query, topic, please don't hesitate to contact me.
Main Topics:
Algorithms, Applied Computer Science, Artificial Intelligence, Coding, Computer Engineering, Computer Networking,Design and Analysis Of Algorithms, Data Structures, Digital Electronics, Object Oriented Programming using C++/Java/Python, Discrete Mathematical Structures, Operating Systems Computer Simulation, Computing, Bit Torrent, Abstract, C, C++, Acrobat, Ada, Pascal, ADABAS, Ad-Aware, Add-in, Add-on, Application Development, Adobe Acrobat, Automatic Data Processing, Adware, Artificial Intelligence, AI, Algorithm, Alphanumeric, Apache, Apache Tomcat, API, Application Programming Interface, Applet, Application, Application Framework, Application Macro, Application Package, Application Program, Application Programmer, Application Server, Application Software, Application Stack, Application Suite, System Administrator, Ada Programming, Architecture, computer software, ASP, Active Server Pages, Assembly, Assembly Language, Audacity, AutoCAD, Autodesk, Auto sketch, Backup, Restore, Backup & Recovery, BASH, BASIC, Beta Version, Binary Tree, Boolean, Boolean Algebra, Boolean AND, Boolean logic, Boolean OR, Boolean value, Binary Search Tree, BST, Bug, Business Software, C Programming Language, Computer Aided Design, Auto CAD, National Testing Agency, NTA,CAD, Callback, Call-by-Reference, Call by reference, Call-by-Value, Call by Value, CD/DVD, Encoding, Mapping, Character, Class, Class Library, ClearCase, ClearQuest, Client, Client-Side, cmd.exe, Cloud computing, Code, Codec, ColdFusion, Command, Command Interpreter, Command.com, Compiler, Animation, Computer Game, Computer Graphics, Computer Science, CONFIG.SYS, Configuration, Copyright, Customer Relationship Management, CRM, CVS, Data, Data Architect, Data Architecture, Data Cleansing, Data Conversion, Data Element, Data Mapping, Data Migration, Data Modeling, Data Processing, Data Scrubbing, Data Structure , Data Transformation, Database Administration, Database Model, Query Language, Database Server, Data log, Debugger, Database Management System, DBMS, Data Definition Language, DDL, Dead Code, Debugger, Decompile, Defragment, Delphi, Design Compiler, Device Driver, Distributed, Data Mart, Data Mining, Data Manipulation Language, DML, DOS, Disk Operating System, Dreamweaver, Drupal, Data Warehouse, Extensible Markup Language, XML, ASCII, Fibonacci , Firefox, Firmware, GUI, Graphical User Interface, LINUX, UNIX, J2EE, Java 2 Platform, Enterprise Edition, Java, Java EE, Java Beans, Java Programming Language, JavaScript, JDBC, Java Database Connectivity, Kernel, Keyboard, Keygen, LAMP, MySQL, Perl, PHP, Python, Logic Programming, Locator, Fusion, Fission, Low-Level Language, Mac OS, Macintosh Operating System, Machine Code, Machine Language, Metadata, Microsoft Access, Microsoft .Net Framework, Microsoft .Net, Microsoft SQL Server, Microsoft Windows, Middleware, MIS, Management Information systems, Module, Mozilla, MS-DOS,Microsoft Disk Operating System, Magic User Interface, MUI, MySQL, Normalization, Numerical, Object-Oriented, Open Source, Solaris, Parallel Processing, Parallel, Patch, Pascal, PDF, Portable Document Format, Postgres, Preemptive, Program, Programming Language, QuickTime, Report Writer, Repository, Rewind, Runtime, Scripting Languages, Script, Search Engine, Software Life-Cycle, VBScript, Virtual Basic Script, Classes, Queues, Stack, B-Tree, Computer Science, Information Technology, IT, CSE Quora profile: www.quora.com/profile/Jayanti...
Find me on Instagram: / jayantikhatrilamba

Пікірлер: 141
@justadev____7232
@justadev____7232 4 жыл бұрын
Best explanation I've found on this algorithm. I spent over 2 hours watching other videos without being able to grasp it. Came across this one and it clicked!! Thank you!!
@vinodkumar-ds2po
@vinodkumar-ds2po 4 жыл бұрын
I came across lots of videos on the internet for this particular problem, but none of them were able to explain in such a decent and nice way like you. Very well explained, thanks a lot :)
@nikmat
@nikmat 4 жыл бұрын
Kidding?
@pg9645
@pg9645 4 жыл бұрын
@@arunakampati4365 Worst hai woh. Bas outdated C language ka incomplete pseudocode deta hai. Waise toh hum bhi explain kare par ek code karke dikhaiyye ? Wastage of time on his videos
@ritupornaduttaroy9205
@ritupornaduttaroy9205 3 жыл бұрын
Dhjrfklkyggfcszcjo
@sdwysc
@sdwysc 3 жыл бұрын
@@pg9645 C language is outdated?
@ABCD-gn5uw
@ABCD-gn5uw 2 жыл бұрын
@@sdwysc to be honest he should have shown the implementation as well. i love his way of explaining but a implementation would be cherry on cake.
@baibhavvikas1767
@baibhavvikas1767 2 жыл бұрын
Thank you ,mam for such an amazing explanation .It solved all my doubts. Apart from other who just showed how to write code u explained how to fill the table in a really fantastic way
@KhushiJain-xx2yk
@KhushiJain-xx2yk 2 жыл бұрын
Best tutor I have ever seen on KZbin 🤗🤗you're amazing ma'am
@RFV7HD
@RFV7HD 4 жыл бұрын
*Amazing explanation saved my lot of time thanx mam* :)
@smilingsna4462
@smilingsna4462 Жыл бұрын
Thank you ma'am so much 😊 I searched a lot about this problem I didn't find a single solution as your so thank you so for explaining it in detail 🙂🙂
@jaewanjang4469
@jaewanjang4469 3 жыл бұрын
Thanks for great interpretation!
@velakuruday
@velakuruday 6 ай бұрын
Thank you sister. You explained in a slow and clear way.
@GulshanKumar-jd2dm
@GulshanKumar-jd2dm 4 жыл бұрын
Nice explanation mam. U also make easier for writing code. Lot of thanks mam😊😊
@priyankataneja7347
@priyankataneja7347 4 жыл бұрын
This video explains whether sum exists or not. Can you explain how can we find pairs. Which all set of elements form the sum,. For Example - {1,3,5,7,10,2,6} - Target Sum - 12 Answer should be - (1,5,6) (10,2 )(5,7)(6,2,3,1). How can we find this thing from this matrix?? Could you please explain this??
@touchskyfacts1391
@touchskyfacts1391 8 ай бұрын
Refer to her next video ..
@kulkiratsingh7924
@kulkiratsingh7924 7 ай бұрын
which one? Can you please share the link to it? @@touchskyfacts1391
@rahuramrt8051
@rahuramrt8051 6 ай бұрын
Link please
@user-mw9vq6me7e
@user-mw9vq6me7e 6 ай бұрын
@@touchskyfacts1391 please bro send me the link?
@deepanshusingh2352
@deepanshusingh2352 5 жыл бұрын
Beautifully explain by you
@AmitSingh-1916
@AmitSingh-1916 4 жыл бұрын
Thank you ma'am👍 for this concept🙂
@HXYZZZ
@HXYZZZ 4 жыл бұрын
Thank you. well explained.
@c.danielpremkumar8495
@c.danielpremkumar8495 4 жыл бұрын
Excellent !
@abhishekrathore2352
@abhishekrathore2352 5 жыл бұрын
Great Explanation
@blackfromabove9383
@blackfromabove9383 4 жыл бұрын
Many many thanks!!
@chenghaowang8759
@chenghaowang8759 3 жыл бұрын
thank you! very useful
@tienthanhpham4596
@tienthanhpham4596 4 жыл бұрын
Your algorithm videos have helped me alot, I'm grateful to you. If you have time, could you make some videos of backtracking?
@rishabhkumar7179
@rishabhkumar7179 4 жыл бұрын
Maim please upload the second video of this to find out the particular subset 🙏
@amandeep0148
@amandeep0148 3 жыл бұрын
Tc mam 🤟🏻🖤 its very useful lect. Mam .thank you very much .🖤
@sugatasaha4423
@sugatasaha4423 4 жыл бұрын
great explanation
@AbhishekKumar-im2xd
@AbhishekKumar-im2xd 4 жыл бұрын
another method is using bitsets::) ll N; cin>>N; vector arr(N); for(auto& it : arr) cin>>it; bitset b(0); b[0]=1; for(auto x : arr) b |= (b
@vaibhavgarg4267
@vaibhavgarg4267 4 жыл бұрын
@Jenny it will be helpful if you can explain how to deduce that we should be creating table in this manner? And, how it is concluded that we need to use this formula? This would help in actual logic building.
@SEVERANCE850
@SEVERANCE850 3 жыл бұрын
Probably she doesn't know and have only by hearted it and started teaching
@yadwindersingh9722
@yadwindersingh9722 5 жыл бұрын
Very Good ma'am
@abhinashbihari2881
@abhinashbihari2881 4 жыл бұрын
Mam U r teaching style is very good
@ShivamSharma-lr2lr
@ShivamSharma-lr2lr 4 жыл бұрын
Thank you so much mam🙏🙏
@IITian-NITian_0305
@IITian-NITian_0305 4 жыл бұрын
Great mam.....
@karthikrangaraju9421
@karthikrangaraju9421 4 жыл бұрын
Why people don't explain the intuition behind problems? :( Can you explain WHY we take value just from above cell vs taking value from the delta????
@ASHISHKUMARJHASONGS
@ASHISHKUMARJHASONGS 3 жыл бұрын
Mam as per your formula sum-A[i] , when sum=8 and arr[i]=7 --> sum-A[i]=1 and in above row A[1]=0 then how could you can write 1 there, please explain mam
@amritpalsingh7262
@amritpalsingh7262 4 жыл бұрын
Great video👌😍, plz upload a series on Fibonacci heap and binomial heap I'll greatly appreciate it. Thanks 🙏
@InderjitSingh-sh9ve
@InderjitSingh-sh9ve 2 жыл бұрын
Kitho veer g tusi
@ashwanikumarsinha6350
@ashwanikumarsinha6350 5 жыл бұрын
thanks
@maheshlangote5436
@maheshlangote5436 2 жыл бұрын
Thank you mam
@basic_theory439
@basic_theory439 4 жыл бұрын
first of all thank you very much for your explanation ,but small suggestion instead of directly hitting the solution kindly try to explain the logic behind that i.e why we are following Dp approach to solve this why Backtracking is not good. IT's like How we can solve this question??? And your answer is DP. But Y?
@JennyslecturesCSIT
@JennyslecturesCSIT 4 жыл бұрын
Actually I have discussed the need of DP in one of my videos... U can check out the playlist Dynamic Programming..
@ritvikraj8384
@ritvikraj8384 2 жыл бұрын
can you give the link of the video in which you have calculated the subset of thhe sum.
@lapujain
@lapujain 4 жыл бұрын
what if the asked weight is too large like 100 or something, then we need to prepare a table for that. Not sure if DP should be used here.
@sonurathod9551
@sonurathod9551 4 жыл бұрын
it was such a great video mam.Can you make videos on Greedy Algorithms??
@zalatanibrah1803
@zalatanibrah1803 4 жыл бұрын
please make a video of how to find a subset thank you..
@sargun_narula
@sargun_narula 3 жыл бұрын
Use backtracking .. go back from the last column last row 1 and note down the row numbers as you proceed back .. you will get the subset
@harrietobwogo720
@harrietobwogo720 4 жыл бұрын
Hey Jenny this approach works if your array has only positive integers..what happens in the case of negative integers being in your list?
@CodingWithPrakash_
@CodingWithPrakash_ 4 жыл бұрын
good question
@princesoni4871
@princesoni4871 4 жыл бұрын
nice explanation mam
@prakhersrivastava2589
@prakhersrivastava2589 4 жыл бұрын
Hello Riya , teaching very good
@karanb2067
@karanb2067 4 жыл бұрын
ma'am please make a video on square root decomposition
@mr68clubshorts
@mr68clubshorts 4 жыл бұрын
THE İMPLEMENTATİON İS NOT CORRECT SİNCE A[i][j-A[i]] part is the reason of array index out of exception error but the explanation is correct the easiest way of implementtaion of this problem is recursive
@bhogeswarasaikumar6351
@bhogeswarasaikumar6351 4 жыл бұрын
How to find those subsets?
@sujithns5033
@sujithns5033 3 жыл бұрын
Thanks for explanation. Can you please tell how to arrive at this solution. In dp, each and every problems seem to be solved differently. It would be helpful if you can explain that. Thanks
@dr.nehajain1366
@dr.nehajain1366 Жыл бұрын
Awesome
@ekanshgaming5854
@ekanshgaming5854 2 жыл бұрын
Excellent Explanation. You are requested to use better quality of marker
@dhawanrishab
@dhawanrishab 3 жыл бұрын
Hello, thanks a lot for the explanation. Just wanted to know why are all elements set to true for sum 0.
@blackscreenm4662
@blackscreenm4662 4 жыл бұрын
Cute mam,,cute explanation.. Love u mam.
@memd777
@memd777 3 жыл бұрын
is it necessary that the Array A = 2,3,5,7,10 needs to be sorted for this to work?
@ramakrishna-jk2jl
@ramakrishna-jk2jl 3 жыл бұрын
No need, it will work with unsorted array as well.
@kattelanithyasri7727
@kattelanithyasri7727 7 ай бұрын
how to print those subsets, please help
@tushargupta2009
@tushargupta2009 4 жыл бұрын
Mam please upload more problems on dynamic Programming
@universalstarcpu9522
@universalstarcpu9522 3 жыл бұрын
If the sum value is high it will be very complex to solve in dp . Is it any other method better than dp in that case?
@diveshrajput572
@diveshrajput572 3 жыл бұрын
Mam, what is the time and space complexity of this algo?
@moustafaali3555
@moustafaali3555 3 жыл бұрын
great but I did not understand how the sum can be equal to zero (first column) if I select A[i] at minute 6:30.
@nadeemmansuri6414
@nadeemmansuri6414 3 жыл бұрын
Mam please make the part two of the subset sum problem.
@nagarjuna119
@nagarjuna119 4 жыл бұрын
core logic is not explained, why you go to upper cell, go back and check in different for value ?
@muskanjindal2921
@muskanjindal2921 3 жыл бұрын
mam how can we include the element when sum is 0
@jrseinc
@jrseinc 4 жыл бұрын
very good explination. I have one question: Is it necessary that the set should be in increasing order for creating DP table?
@thepenguineterror
@thepenguineterror 4 жыл бұрын
Yes otherwise the maximum sum will yhe sum of all positive number in the array
@ankitamittal2618
@ankitamittal2618 2 жыл бұрын
can u plz explain why u write 1 in column having value 0 ? what i understand is if we write 1 means we can make a subset and by having subset with value 2 or other, sum will not be 0. plz explain it
@biswajitsahu7565
@biswajitsahu7565 5 жыл бұрын
mam,Where is the 2nd part!¿
@AnandKumar-ro1yd
@AnandKumar-ro1yd 3 жыл бұрын
Could you make more videos on problem solving and Dynamic problem
@ivandrofly
@ivandrofly 2 ай бұрын
Why we need to row-1? Why not taking from current row? The value for row is already computed
@kishanpandey5219
@kishanpandey5219 Жыл бұрын
If the sum is given 50 then .....will these tables still be feasible?
@maheshpatil-pf2fd
@maheshpatil-pf2fd 3 жыл бұрын
does the element of the should be return in sorted manner
@ramakrishna-jk2jl
@ramakrishna-jk2jl 3 жыл бұрын
No need, it will work with unsorted array as well.
@singhscribe7450
@singhscribe7450 7 ай бұрын
kindly mention the error in the table's last row and column where it shall be 0. If I am wrong, please let me know.
@nagavenkataprakash4837
@nagavenkataprakash4837 3 жыл бұрын
Mam please make videos on oops concepts in Java
@chandanbk114
@chandanbk114 Жыл бұрын
is this method using back tracking ?
@thepenguineterror
@thepenguineterror 4 жыл бұрын
Plzz make more videos on DP
@kunjeyan_5875
@kunjeyan_5875 4 жыл бұрын
Very nice explanation.. Loved it... But Ma'am, please explain why we are going to one cell back and then subtracting the value of i and getting the value of that cell (if the value in previous cell is 0) and if it is 1 we directly copy 1....please explain the logic behind this.
@HXYZZZ
@HXYZZZ 4 жыл бұрын
you are targeting to get sum listed on top row. when your cell value is [left column] less than sum you are looking for, you are going back and see whether that difference can be achieved, by looking at that cell [the sum value listed in the top]
@sachink.s838
@sachink.s838 4 жыл бұрын
mam plz explain print all subset
@Charlie-jx6mv
@Charlie-jx6mv 4 жыл бұрын
Divide and conquer leads dividing main problem in to subproblems...
@riteshchauhan0027
@riteshchauhan0027 4 жыл бұрын
Can you solve it with State space tree
@aswadkakumani7379
@aswadkakumani7379 4 жыл бұрын
can you explain me how to solve any problem by using dynamic programming ..
@balajee41
@balajee41 3 жыл бұрын
Will it work if the sum is odd number? I wrote code on my own based on your explanation. It is not working if the sum is odd number.
@SOURAVKUMAR-ps4zr
@SOURAVKUMAR-ps4zr 4 жыл бұрын
Mam please give me an example of back-tracking
@JennyslecturesCSIT
@JennyslecturesCSIT 4 жыл бұрын
check my video about it
@young_age_designer1493
@young_age_designer1493 3 жыл бұрын
Mam can you do video on subset program
@prashantkumar2963
@prashantkumar2963 4 жыл бұрын
how does it work?
@greninjadp2564
@greninjadp2564 3 жыл бұрын
mam particular subset second vedios plz
@GauravSingh-fy7do
@GauravSingh-fy7do 5 жыл бұрын
Nic
@Akz77977
@Akz77977 4 жыл бұрын
24:41 , it will be A [ i - 1 ] [ j - A (i - 1) ] = 1
@ashishdaniel169
@ashishdaniel169 3 жыл бұрын
it is [i-1] in the first block because we are considering the previous row.. but when we are subtracting j-A(i) we are subtracting A(i) from the current row.. So j-A(i) is correct
@bharatjoshi1473
@bharatjoshi1473 3 жыл бұрын
jenny the video is very help full about what we have to do , but it doesn't speaks any anything about Why we are doing it eg at 8:56 it says we have to do sum- A[i] but its not very clear why we are doing it why not Sum- A[j] or A[i]-A[j] ?
@infotainment7123
@infotainment7123 4 жыл бұрын
HOW TO WRITE CODE FOR IT?
@thiraviamnatarajan5903
@thiraviamnatarajan5903 4 жыл бұрын
Mam plz put queen problem
@yatri6329
@yatri6329 2 жыл бұрын
What if array is not sorted
@Pkhanwal
@Pkhanwal 5 жыл бұрын
Hello mam.. Is this solve by using backtracking
@bhaskarbhasku2921
@bhaskarbhasku2921 5 жыл бұрын
Yes you can
@selva140
@selva140 Жыл бұрын
why you choose other elem for the sum=0
@harshittiwari2281
@harshittiwari2281 4 жыл бұрын
Mam what if the we have given sum like 245
@Ayush_45_
@Ayush_45_ 2 ай бұрын
How to add 50 lines??
@retrogame3138
@retrogame3138 4 жыл бұрын
please upload hd video quality
@crazydrifter13
@crazydrifter13 4 жыл бұрын
Mam, please avoid uploading in just 360p. It might appear fine now but people would hit dislike on your Good content when era of 5g and 4K arrives. Think long term for your channel.
@gauransh18
@gauransh18 Жыл бұрын
how to calculate subset you said you'll make a video its been 3 years
@Historicalfacts60
@Historicalfacts60 3 жыл бұрын
Mam u are looking gorgious
@jayantgoel001
@jayantgoel001 4 жыл бұрын
Ma'am at @20:15 u said there will be another video of subset problem Can u please give link for the same Thank u in advance
@nainaagrawal8314
@nainaagrawal8314 3 жыл бұрын
Next video link plss..
@yashwinkolangi524
@yashwinkolangi524 2 жыл бұрын
Mam I guess in the place A[i]=3 and sum(j) =4 should be 1 😅
@kedarmuley4142
@kedarmuley4142 4 жыл бұрын
Ma'am second video???
@thinkimagine6445
@thinkimagine6445 Жыл бұрын
so cute
@yobro7051
@yobro7051 4 жыл бұрын
can u please provide the code
@CodingWithPrakash_
@CodingWithPrakash_ 4 жыл бұрын
kzbin.info/www/bejne/m5vVZKugbZmnlbM
@shubham8835
@shubham8835 3 жыл бұрын
no one explains why we are going backwards and simply copying values.. we are not here to mug things up
@chitranshkulshrestha485
@chitranshkulshrestha485 3 жыл бұрын
Explanation is good but this is not a right way to teach DP. First we need to understand the recursive logic and when the recursive logic is developed then only we can made a DP solution. Video like this did not include basics of DP and no can solve questions of DP directly by making a table. If you do not know which problem is overlapping then how you can do so.
Longest Common Subsequence- Dynamic Programming | Data structures and algorithms
25:47
6.2 Sum Of Subsets Problem - Backtracking
12:19
Abdul Bari
Рет қаралды 1,3 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 82 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 11 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
Traveling Salesman Problem using Dynamic Programming | DAA
31:33
Jenny's Lectures CS IT
Рет қаралды 527 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 614 М.
0/1 knapsack problem-Dynamic Programming | Data structures and algorithms
27:31
Jenny's Lectures CS IT
Рет қаралды 1,1 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 82 МЛН