Тёмный

4.3 Matrix Chain Multiplication - Dynamic Programming 

Abdul Bari
Подписаться 1 млн
Просмотров 1,7 млн
50% 1

Matrix Chain Multiplication
Dynamic Programming
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...

Опубликовано:

 

15 фев 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 694   
@studyonline3236
@studyonline3236 5 лет назад
Sir, you've saved my time by investing yours.
@Rei816kgu
@Rei816kgu 4 года назад
Mr. Bari must be tired from carrying me through my algorithms course
@DG-kv3qi
@DG-kv3qi Год назад
carrying us all lmao
@shivaramgoli6333
@shivaramgoli6333 Год назад
How can we select no of rows and columns for m. And s matrices
@xiping-pongfatherofchinese3551
Bsdk sir tujhe jaante v nhi honge!!
@ramagirisaiganesh3044
@ramagirisaiganesh3044 11 месяцев назад
@@shivaramgoli6333 number of matrices that u r multiplying Ex: A1,A2,A3,.....An then take n*n matrix of m and s
@Alchemace
@Alchemace 3 дня назад
@@shivaramgoli6333 On the basis of number of matrices attempt to multiply. here are 4*4 because A1 * A2 * A3 * A4.
@amirshariatmadari9810
@amirshariatmadari9810 2 года назад
Mr. Bari, Thank you so much for providing free content that explains algorithms simply but also comprehensively.
@SachinMooZZ
@SachinMooZZ 6 лет назад
I was freaking out about taking a quiz on this topic and feeling hopeless till I stumbled upon this guy's explanation. He instantly put me at ease. His voice is so calming.
@benji1570
@benji1570 3 года назад
Even though a Taiwanese like me could understand what he is teaching(with his accent), what a miracle
@ritik84629
@ritik84629 5 лет назад
4:32 He used Catalan number to find possible number of binary trees with n nodes
@nigahrehem9094
@nigahrehem9094 4 года назад
Thanks
@ibadshakil4051
@ibadshakil4051 2 года назад
After that [1,3] Bari sir why u dont take value [1,4] if some one known that plz answer
@ibadshakil4051
@ibadshakil4051 2 года назад
After that [1,3] Bari sir why u dont take value [1,4] if some one known that plz answer
@Pixelatory
@Pixelatory 4 года назад
Literally the best channel for learning things in my algorithms class
@manavssingh
@manavssingh 4 года назад
Sir, thank you very much.. despite the lack of explanation of the S matrix (which the comments section made up for), I am very satisfied with this (free) content you are providing helping us fellow students get through exams! You are doing social service here!
@aadishjoshi2525
@aadishjoshi2525 6 лет назад
The best video I've ever seen. Referring this video from the University of Texas,USA. Thank you for such a beautiful narration.
@Thandav0
@Thandav0 6 лет назад
Thanks for the video bro
@kamransiddiqui4729
@kamransiddiqui4729 5 лет назад
thandav63 bhai tu pagal hai kya??
@michap21
@michap21 3 года назад
Hook 'Em!
@vinayak186f3
@vinayak186f3 3 года назад
Kya bhai US ja kr bhi YT par padhai kar rhe ho 😶
@sanjayvasnani988
@sanjayvasnani988 2 года назад
@@vinayak186f3 University/Country changes but YT is constant!
@sasa_lilac6295
@sasa_lilac6295 6 лет назад
thank you sir... it helped alot.. its very easy understanding your explanation.. i have my algorithms exam tomorrow and your lectures saved me alot of time ... keep uploading more videos
@jaatharsh
@jaatharsh 3 года назад
I was stumped on facing this question, but sir you're my saviour, cannot thank u enough for explaining such complex algo in elegant & simple way.
@yt_akashupadhyay
@yt_akashupadhyay 5 лет назад
For those who are wondering how S table is filled... Assume your answer come out to be : [ A1 A2 ] [ A3 ] so you've partitioned the whole multiplication at 2nd matrix, thus answer is 2 Assume another answer come out to be : [A1] [A2 A3 A4] so you've partitioned the whole multiplication at 1st matrix, thus answer is 1 Another example : [A1 A2 A3] [A4] so you've partitioned the whole multiplication at 3rd matrix, thus answer is 3. Give a thumbs up if u got this.
@kunalchouhan3829
@kunalchouhan3829 5 лет назад
Impressive 👍
@Rock28099
@Rock28099 5 лет назад
what about s[1,2] =1?
@yt_akashupadhyay
@yt_akashupadhyay 5 лет назад
@@Rock28099 Yep..because you can multiply two matrix in only one way given they satisfy multiplication condition, not only s[1,2] = 1 but also s[2,3] = 2 and s[3,4] = 3. Watch the video from 3:10. I hope u'll understand.
@Rock28099
@Rock28099 5 лет назад
@AkashUpadhyay u said the values in Matrix S represent the partition where matrix was divided...but in the case of M[2,3] its 2 and M[3,4] its 3...so how the partition was done In these two case? Thanks in advance
@aadityaojha1756
@aadityaojha1756 5 лет назад
My God..you are next level Man...from where did you get that?? I wish I could meet you once and take your autograph...
@TridibSamanta
@TridibSamanta 5 лет назад
Great ! You are a great Teacher. Thanks for saving my Design and analysis of Algorithm Paper. #Respect
@jacopotoso6573
@jacopotoso6573 6 лет назад
An example is worth a thousand words. Simple and clear video. thank you
@exapsy
@exapsy 6 лет назад
I won't even bother watching the whole video to make this comment. Your video is awesome, very descriptive and clean. Really one of the best explanation if not the best. Thanks for the effort! (continuing the video)
@kabichan1
@kabichan1 3 года назад
all professors across the nation should take notes from your teaching, and thank you so much
@manojmaurya9683
@manojmaurya9683 4 года назад
I searched a lot more videos for matrix chain multiplication using dynamic programming nobody able to explain or persuade such a way of clarity...thanks sir #i_m your big #fan
@adityakumar-kj3ch
@adityakumar-kj3ch 6 лет назад
The best teacher I have come across till now...
@ubaidhunts
@ubaidhunts Год назад
s matrix not explained properly
@bran_rx
@bran_rx 3 года назад
i like how he stares directly at the camera, feels personal lol... great video, helped me a lot
@avonflex5031
@avonflex5031 5 лет назад
for the formula we must write under min i
@ryanhull2472
@ryanhull2472 4 года назад
Awesome video!!! Really appreciate the great work you do. A little trick i found to do these problems is simply write out which parenthesization gave the best answer, then you can actually work backwards. ie) you find the best with 4 which is (A1 A2 A3) (A4) Then comebine that with what you get for the best with 3 parentheses (A1) (A2 A3) and add them around A2 A3 etc
@abdullahafzal4768
@abdullahafzal4768 Год назад
wonderful
@prasannareddyisireddy8233
@prasannareddyisireddy8233 6 лет назад
Thank you sir!! Clear explanation without unnecessary information!!
@dharaneeswari-wi8ef
@dharaneeswari-wi8ef 2 месяца назад
really thank you so much sir ...i understand very clearly...my mam follows your classes and then she is explaining in the class same as u told
@UmangMundhara
@UmangMundhara 6 лет назад
i have gone through all your previous videos and your explanation and everything is really helpful, thanks a lot for making this series of videos , would like you to make videos on different topics , and once again thanks a lot :)
@gouravjindal297
@gouravjindal297 4 года назад
Sir honestly you are the best teacher that I have ever learnt from. You make algorithm so easy subject to understand. Thanks sir
@jimmyp4584
@jimmyp4584 5 лет назад
So thankful to you sir for explaining such complex topics so easily. Thank you very very much.
@richasha670
@richasha670 3 года назад
Sir, you are awesome. Cause it's important, I`ll say it again. YOU ARE AWESOME.
@supriyajha7823
@supriyajha7823 6 лет назад
Great explanation! I finally completed one topic properly :)
@ethanbai5712
@ethanbai5712 5 лет назад
Amazingly explained! Thank youso much!
@rajarshiparihar9932
@rajarshiparihar9932 6 лет назад
One of the best tutor... thank you so much sir for such a good explanation.
@viplavkhode2742
@viplavkhode2742 4 года назад
For those who are still confused with the table S: It is filled with the min. value of K (K is introduced at 17:50 ). Example: for M[2,4] we have selected -> (A2*A3)*A4 which gives -> M[2,3]+M[4,4]+4*2*7 compare this with : -> M[i][j] = min { M[i,K]+ M[K+1,j] + .... } we get K=3 Put the minimum value of K into the table S Let me know, if you got this 👍👍👍👍
@viplavkhode2033
@viplavkhode2033 4 года назад
Thank you sooo much, you saved my life 🙌🙌🙌🙌🙌
@rushikeshchoudhary5433
@rushikeshchoudhary5433 4 года назад
Beautiful 💓❣️❣️💕❤️❤️
@khalilkhanmamakhel3951
@khalilkhanmamakhel3951 3 года назад
dear i am still confused ? are the value of k put in the s table ?
@viplavkhode2742
@viplavkhode2742 3 года назад
@@khalilkhanmamakhel3951only minimum value of K is added to table S
@khalilkhanmamakhel3951
@khalilkhanmamakhel3951 3 года назад
@@viplavkhode2742 tnx dear
@hardikvansia3293
@hardikvansia3293 5 лет назад
We all appreciate your hardwork !! May be we all not get good teacher however the person like you are still on Earth who are putting effort to make good student Thanks for full fill our hunger knowledge. I hope you will always be blessed by God and may God full fill your all dreams. Once again thank you for your time and efforts.
@ediellopez1718
@ediellopez1718 5 лет назад
Phenomenal explanation, sir! Thank you!
@RebeCcaHarOon
@RebeCcaHarOon 5 лет назад
Thank you sir. I've learned a lot from your videos. Keep teaching us.
@milicamisic4011
@milicamisic4011 2 года назад
awesome video, much better than my college lessons, thank a lot ❤
@domenico2178
@domenico2178 6 лет назад
Best video for this category. Thx from Italy University.
@raviraj8209
@raviraj8209 5 лет назад
thanks alot .. before this video i was totally demoralized ,,almost gave up on topic . after this video.. i am happy now :D . easy and sophistacated.
@softwareengineer8923
@softwareengineer8923 Год назад
Such an amazing and lucid video as usual!
@nayaandmati2503
@nayaandmati2503 5 лет назад
great explanation , got to say it is the best video about D.programing
@Picklerick8859
@Picklerick8859 Год назад
Every time I was stuck at some problem I would watch your videos :D
@igrai
@igrai 6 лет назад
excellent, easy to grasp explanation - thank you!
@kuravje484
@kuravje484 Год назад
This man literally carries all the computer science students in the world on his back
@patchworky
@patchworky 2 года назад
This has been a godsend, thank you so much!
@saurabhpal6210
@saurabhpal6210 6 лет назад
Clearly and Best Explanation thank u for this video Sir.
@krishnachaitanya2520
@krishnachaitanya2520 3 года назад
wow! How did I not find this earlier. Thank you so much!
@zerr0n7eet
@zerr0n7eet 6 лет назад
You are a class teacher sir,just loved all your videos. The way you explain,makes everything look so easy ! Thank you sir :)
@anoygolui1057
@anoygolui1057 3 года назад
sir u r legend .... i was't able to understood the topic untill i watch ur video ....... u r mindblowing sir .......thank you sir.
@sierr1302
@sierr1302 Год назад
My prof is insufferable and I can't learn anything from him but Chaddul taught me this in 20 minutes. Not all heroes wear capes. ❤
@VinhPham-hz8ny
@VinhPham-hz8ny 4 года назад
You are an awesome instructor sir. Thank you very much for your teaching.
@jenishmonpara
@jenishmonpara 4 года назад
Best found Matrix Chain Multiplication explanation 👏🏻
@TheMrdiasmike
@TheMrdiasmike 6 лет назад
great video, you really helped me with my algorithms class! much appreciation
@wrestling_hd_core6618
@wrestling_hd_core6618 3 года назад
Sir u r my savior, I love the way u explain its soooo simple and informative
@AbulAlArabi07
@AbulAlArabi07 2 года назад
Thanks a lot for such a video. Saved my tons of time. I wish my instructor was like you
@ramneeksehgal1760
@ramneeksehgal1760 5 лет назад
Nice..Before watching this video....DP is rocket science for me...But now its been bit easier... Thnx...I recommended this to all my frnds.
@ashraf645615
@ashraf645615 6 лет назад
Apka tahedil se bahut bahut shukriya Kal ke paper (rtu exam) k liye jitni bhi padhai Kari sab apke video se Kari... thanks a lot
@ashraf645615
@ashraf645615 6 лет назад
Abdul Bari bahut hi acha explain krte h sir aap, saare concept ache se clear karwae, thanks once again I'll definitely score good in my exam, hum jese students ki dua hamesha apke saath h 😊
@sourabhkhandelwal1568
@sourabhkhandelwal1568 6 лет назад
I am also from RTU, 6th Sem CSE. How was your DAA paper?
@ashraf645615
@ashraf645615 6 лет назад
sourabh khandelwal good, what about you?
@sourabhkhandelwal1568
@sourabhkhandelwal1568 6 лет назад
Ashraf Mansuri Good paper was easy ,☺
@ashraf645615
@ashraf645615 6 лет назад
sourabh khandelwal for me all credit goes to Abdul Bari sir... I prepared in very less time with these videos.. as you know 1 or 2 day before the exam.. 🙂
@abhishekpatyal7480
@abhishekpatyal7480 4 года назад
Well explained abdul!! Just want to correct. T(3) != 5 at 4:40. Number of ways to insert n pairs of parentheses in a word of n+1 letters, e.g., for n=2 there are 2 ways: ((ab)c) or (a(bc)). So, to get number of distinct ways with which we can perform matrix chain multiplication, we have to find T(n+1)
@aoyukialquen2835
@aoyukialquen2835 6 месяцев назад
hii im confused on T(n) = 2n Cn / n+1. What is Cn? What does it do? Thank you
@coolone5561
@coolone5561 Месяц назад
@@aoyukialquen2835 It's math. Check Permutations and Combinations topic. C for combinations. If you have 4 letters and want to find how many combinations of these letters can be formed with size 2, then the answer is 4C2 = 4!(4-2)!/2! = 4!2!/2! = 4! = 24. But the formula 2nCn/n+1 is taken from a topic "Catalan Number". Hope it helps!
@everythingsucks709
@everythingsucks709 4 года назад
this guy is simply AMAZING !
@sheikhaman6218
@sheikhaman6218 3 года назад
My eager to learn and this RU-vid algorithms brought us together
@anishpaudel29
@anishpaudel29 5 лет назад
For those who are wondering how S-table is filled: It's more like the value of K we choosing for the minimum value in M-table.
@surajsingh7943
@surajsingh7943 6 лет назад
Thank you so much sir...it was really awesome explanation...keep it up...
@william0377
@william0377 5 лет назад
way better than my professor's teaching, thank you
@SARCASMOOO
@SARCASMOOO 5 лет назад
I see a lot of people asking about the s matrix. I may be wrong as I am learning this rn to but I'll see if I can explain this. The fourth step in dynamic programming is to develop an optimal solution. So we need the s matrix to give us information on where we will put the parentheses when displaying our solution. This pseudo code is from the Introduction to algorithms textbook on this problem print0ptimal-parens(s, i, j) if i == j print "A"i else print "(" print0ptimal-parens(s, i, s[i, j]) print0ptimal-parens(s, i[i, j] + 1, j) print ")" So essentially the optimal solution is broken down into subproblems which are solved optimally. Once we solve the subproblem optimally, the k value which is where we put the parenthesize will be stored in the s matrix. Lastly, on step 4 of dynamic programming, we recursively go through the s array printing out where the optimal brackets go giving our solution. Just for reference the four steps of dynamic programming are 1. Characterize the structure of an optimal solution. 2. Recursively define the value of an optimal solution. 3. Compute the value of an optimal solution. 4. Construct an optimal solution from computed information.
@SaumyaSharma007
@SaumyaSharma007 3 года назад
Sir you are the best..... Long live Sir 🙏 🤗 may God bless you
@MagedT
@MagedT Год назад
Sir, Your are the best to visualize DSA, Thank you very much.
@armanhayrapetyan4551
@armanhayrapetyan4551 2 года назад
Mr. Bari, Thank you from Yerevan, Armenia
@emgm6207
@emgm6207 2 года назад
Thank you sir! You helped me a lot understanding analysis of algorithm!
@hobihobi1563
@hobihobi1563 5 лет назад
you teach better than every single one of my uni professors
@user-pc1ei4kv8q
@user-pc1ei4kv8q 6 лет назад
very good! I was confused when reading this topic in an algorithms book. it helps me a lot! Thank!
@abdulmn
@abdulmn 3 года назад
Assalamualiakum Sir, Your Videos have helped me get through my exams.
@ishytas6654
@ishytas6654 5 лет назад
Thank you so much... Amazing video... Very helpful !!
@user-wu9qr5bg1n
@user-wu9qr5bg1n 7 месяцев назад
Thank you sir, this is the best algorithm lesson that I have learned.
@evanverma1316
@evanverma1316 3 месяца назад
Mr. Bari has anyone ever told you that you are a suave man because you are!
@sudhaganesh6419
@sudhaganesh6419 4 года назад
Thank you sir. This was very helpful :)
@anayaanson8095
@anayaanson8095 4 года назад
Really a good explanation... Really helped me... Thanks 4 this good explanation video... 😊
@waseemakhtar7541
@waseemakhtar7541 6 лет назад
Sir I don't see ur dbms videos online yet!!.... Because of u and Dr GaryBoetticher i learnt dbms concepts..Please upload relational algebra/ tuple calculus topic ...Thanks
@danishiqbal9826
@danishiqbal9826 6 лет назад
Respect respect.. Sir u saved me and i took victory from judgment day (exam) :) : p
@debdeeppaulchaudhuri9714
@debdeeppaulchaudhuri9714 6 лет назад
Sir, please tell me how the combination formula came up or rather the logic behind it??
@mrAmal45
@mrAmal45 6 лет назад
watch in 1.5x. It is perfect
@nikhilbalwani2285
@nikhilbalwani2285 5 лет назад
Don't try and rush. 1x has always been the best.
@praharshbhatt2934
@praharshbhatt2934 5 лет назад
2x is still slow for me
@prudvi01
@prudvi01 5 лет назад
Exactly been watching his videos at 2x all the time
@avokadotropical3362
@avokadotropical3362 5 лет назад
@@nikhilbalwani2285 well if you've got an exam in less than 24 hours you know you gotta rush
@nikhilbalwani2285
@nikhilbalwani2285 5 лет назад
@@avokadotropical3362 Then you've got to start preparing earlier than this. When you watch things 1.5x, 2x, all of it boils down to just procedure, and you lose the essence of teaching.
@aritchat
@aritchat 4 года назад
Thank you sir for this wonderful explanation.
@m.younaschaudhary9363
@m.younaschaudhary9363 Год назад
bundle of thanks, I wish Virtual University select instructer like you for Fundamental of algorithem course
@priyankamanna4550
@priyankamanna4550 3 года назад
Sir teaching method is great please make more videos on programming concepts 🙏
@md.shahinbashar7239
@md.shahinbashar7239 5 лет назад
Awesome... it's very helpful.. love u sir
@maheshvangala8472
@maheshvangala8472 5 лет назад
Awesome explaination Thank you sir
@karimamoumene8509
@karimamoumene8509 2 года назад
that was absolutely helpful. Thank you!
@FootyPick
@FootyPick 6 лет назад
To all Those who are not understanding he (sir) is filling the table watch at 17:10 min you will probably understand explanation he is filling second table with matrix dimension which gives minimal value thats's it :)
@udbharat_official
@udbharat_official 5 лет назад
then for m[2,4] entry should be 2 in S table . . but how its 3 ? .... pl explain. TIA
@udbharat_official
@udbharat_official 5 лет назад
Pl check the next video . . I found the answer there
@aparnamukherjee2312
@aparnamukherjee2312 5 лет назад
Thank you sir... It helped me a lot😊
@ViamalaN1
@ViamalaN1 4 года назад
Great explanation and visualization!
@vathsavaidhruthi1260
@vathsavaidhruthi1260 29 дней назад
if you are wondering abt s table .those are the values of k used to get minimum
@venky3867
@venky3867 5 лет назад
Sir you're God Thanks for explanation
@daviddelgado6599
@daviddelgado6599 6 месяцев назад
every day I get more impressed of the knowlegde of this guy
@shreyashankar7955
@shreyashankar7955 2 года назад
Thank you sir your videos helped me understand the concept.
@GrumpyCoder
@GrumpyCoder 7 месяцев назад
Mr. Bari is a god. My teacher of data structures & algorithms at University was so bad, Mr. Bari teach me how it's done. When people ask how I passed and learned all of this I reply: Abdul Bari.
@herbertkip
@herbertkip 5 лет назад
Thank you. You are a savior!
@laxmanchoudhary2367
@laxmanchoudhary2367 5 лет назад
Best explanation, twist i like after 19:20 about table S
@maryambabar184
@maryambabar184 5 лет назад
very well explained sir!!thankyou
@Ashishhd7
@Ashishhd7 4 года назад
Sir , Your way of teaching is very nice .
@muzammilmueen3487
@muzammilmueen3487 6 лет назад
A better explanation to the problem than my professor at Georgia Tech ..
@UNnamed66
@UNnamed66 6 лет назад
Thank you from a student at Cal Poly
@ozgurbaskn7559
@ozgurbaskn7559 5 лет назад
Very informative. Thank you so much
@IamAnsumanDas
@IamAnsumanDas Месяц назад
Thank You Sir for your simplified explanation.
Далее
4.5 0/1 Knapsack - Two Methods - Dynamic Programming
28:24
🎙СТРИМ на 4 МИЛЛИОНА🍋
3:12:45
Просмотров 1,3 млн
5,000 BLUNDERS?!?!?!?!?!
8:46
Просмотров 26 тыс.
3.5 Prims and Kruskals Algorithms - Greedy Method
20:12
Matrix Chain Multiplication - Dynamic Programming
31:01
The Algorithm Behind Spell Checkers
13:02
Просмотров 409 тыс.