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.
@kunalchouhan38295 жыл бұрын
Impressive 👍
@GateCSE2805 жыл бұрын
what about s[1,2] =1?
@yt_akashupadhyay5 жыл бұрын
@@GateCSE280 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.
@GateCSE2805 жыл бұрын
@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
@aadityaojha17565 жыл бұрын
My God..you are next level Man...from where did you get that?? I wish I could meet you once and take your autograph...
@studyonline32365 жыл бұрын
Sir, you've saved my time by investing yours.
@umangsomani72242 ай бұрын
5:47 se dekh aur 5 min bachege
@Rei816kgu4 жыл бұрын
Mr. Bari must be tired from carrying me through my algorithms course
@DG-kv3qi2 жыл бұрын
carrying us all lmao
@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 Жыл бұрын
@@shivaramgoli6333 number of matrices that u r multiplying Ex: A1,A2,A3,.....An then take n*n matrix of m and s
@Alchemace5 ай бұрын
@@shivaramgoli6333 On the basis of number of matrices attempt to multiply. here are 4*4 because A1 * A2 * A3 * A4.
@SachinMooZZ6 жыл бұрын
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.
@benji15703 жыл бұрын
Even though a Taiwanese like me could understand what he is teaching(with his accent), what a miracle
@viplavkhode27424 жыл бұрын
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 👍👍👍👍
@viplavkhode20334 жыл бұрын
Thank you sooo much, you saved my life 🙌🙌🙌🙌🙌
@rushikeshchoudhary54334 жыл бұрын
Beautiful 💓❣️❣️💕❤️❤️
@khalilkhanmamakhel39513 жыл бұрын
dear i am still confused ? are the value of k put in the s table ?
@viplavkhode27423 жыл бұрын
@@khalilkhanmamakhel3951only minimum value of K is added to table S
@khalilkhanmamakhel39513 жыл бұрын
@@viplavkhode2742 tnx dear
@ritik846295 жыл бұрын
4:32 He used Catalan number to find possible number of binary trees with n nodes
@nigahrehem90944 жыл бұрын
Thanks
@ibadshakil40512 жыл бұрын
After that [1,3] Bari sir why u dont take value [1,4] if some one known that plz answer
@ibadshakil40512 жыл бұрын
After that [1,3] Bari sir why u dont take value [1,4] if some one known that plz answer
@krishanpalsinghrajput2530Ай бұрын
underrated comment!
@amirshariatmadari98102 жыл бұрын
Mr. Bari, Thank you so much for providing free content that explains algorithms simply but also comprehensively.
@aadishjoshi25256 жыл бұрын
The best video I've ever seen. Referring this video from the University of Texas,USA. Thank you for such a beautiful narration.
@Thandav06 жыл бұрын
Thanks for the video bro
@kamrancamy19976 жыл бұрын
thandav63 bhai tu pagal hai kya??
@michap214 жыл бұрын
Hook 'Em!
@vinayak186f33 жыл бұрын
Kya bhai US ja kr bhi YT par padhai kar rhe ho 😶
@sanjayvasnani9883 жыл бұрын
@@vinayak186f3 University/Country changes but YT is constant!
@manavssingh4 жыл бұрын
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!
@exapsy6 жыл бұрын
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)
@Pixelatory5 жыл бұрын
Literally the best channel for learning things in my algorithms class
@avonflex50316 жыл бұрын
for the formula we must write under min i
@jaatharsh4 жыл бұрын
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.
@adityakumar-kj3ch6 жыл бұрын
The best teacher I have come across till now...
@bran_rx3 жыл бұрын
i like how he stares directly at the camera, feels personal lol... great video, helped me a lot
@TridibSamanta6 жыл бұрын
Great ! You are a great Teacher. Thanks for saving my Design and analysis of Algorithm Paper. #Respect
@sasa_lilac62956 жыл бұрын
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
@hardikvansia32936 жыл бұрын
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.
@ecmuppet95382 ай бұрын
My exam is tomorrow and it has 3 questions and this is one that is on the exam, thank you good sir for your service
@ryanhull24725 жыл бұрын
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 Жыл бұрын
wonderful
@ShadowzSharma24 күн бұрын
5 years and this is the hidden gem. not for coding but definitely for academics
@richasha6704 жыл бұрын
Sir, you are awesome. Cause it's important, I`ll say it again. YOU ARE AWESOME.
@manojmaurya96835 жыл бұрын
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
@abhishekpatyal74805 жыл бұрын
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)
@aoyukialquen283511 ай бұрын
hii im confused on T(n) = 2n Cn / n+1. What is Cn? What does it do? Thank you
@coolone55617 ай бұрын
@@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!
@kabichan13 жыл бұрын
all professors across the nation should take notes from your teaching, and thank you so much
@gouravjindal2975 жыл бұрын
Sir honestly you are the best teacher that I have ever learnt from. You make algorithm so easy subject to understand. Thanks sir
@jacopotoso65736 жыл бұрын
An example is worth a thousand words. Simple and clear video. thank you
@ashraf6456156 жыл бұрын
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
@ashraf6456156 жыл бұрын
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 😊
@sourabhkhandelwal15686 жыл бұрын
I am also from RTU, 6th Sem CSE. How was your DAA paper?
@ashraf6456156 жыл бұрын
sourabh khandelwal good, what about you?
@sourabhkhandelwal15686 жыл бұрын
Ashraf Mansuri Good paper was easy ,☺
@ashraf6456156 жыл бұрын
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.. 🙂
@priyankabehera828825 күн бұрын
For s table: Put k value i
@matthewzarate88512 ай бұрын
This exact recurrence relation was explained in my lecture and in my textbook but it made absolutely no sense. Thank you for explaining it so well! You made it 100% clear.
@dharaneeswari-wi8ef7 ай бұрын
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
@FootyPick6 жыл бұрын
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_official6 жыл бұрын
then for m[2,4] entry should be 2 in S table . . but how its 3 ? .... pl explain. TIA
@udbharat_official6 жыл бұрын
Pl check the next video . . I found the answer there
@mrAmal456 жыл бұрын
watch in 1.5x. It is perfect
@nikhilbalwani22856 жыл бұрын
Don't try and rush. 1x has always been the best.
@praharsh_bhatt6 жыл бұрын
2x is still slow for me
@prudvi016 жыл бұрын
Exactly been watching his videos at 2x all the time
@avokadotropical33626 жыл бұрын
@@nikhilbalwani2285 well if you've got an exam in less than 24 hours you know you gotta rush
@nikhilbalwani22856 жыл бұрын
@@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.
@ramneeksehgal17606 жыл бұрын
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.
@SARCASMOOO5 жыл бұрын
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.
@kuravje4842 жыл бұрын
This man literally carries all the computer science students in the world on his back
@Picklerick8859 Жыл бұрын
Every time I was stuck at some problem I would watch your videos :D
@anoygolui10574 жыл бұрын
sir u r legend .... i was't able to understood the topic untill i watch ur video ....... u r mindblowing sir .......thank you sir.
@abdulmn4 жыл бұрын
Assalamualiakum Sir, Your Videos have helped me get through my exams.
@m.younaschaudhary9363 Жыл бұрын
bundle of thanks, I wish Virtual University select instructer like you for Fundamental of algorithem course
@armanhayrapetyan45512 жыл бұрын
Mr. Bari, Thank you from Yerevan, Armenia
@hobihobi15635 жыл бұрын
you teach better than every single one of my uni professors
@anishpaudel295 жыл бұрын
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.
@GrumpyCoder Жыл бұрын
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.
@rajarshiparihar99326 жыл бұрын
One of the best tutor... thank you so much sir for such a good explanation.
@domenico21786 жыл бұрын
Best video for this category. Thx from Italy University.
@wajeehsyed5919Ай бұрын
you are my goat, please never change
@SaumyaSharma0073 жыл бұрын
Sir you are the best..... Long live Sir 🙏 🤗 may God bless you
@sierr13022 жыл бұрын
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. ❤
@jaikrishnapandey6323 жыл бұрын
Right now I am only thinking about people who came here for dislike....How can someone just do this...Such a great teacher with awesome explanation and that also for free...Just think before doing this
@jenishmonpara4 жыл бұрын
Best found Matrix Chain Multiplication explanation 👏🏻
@MagedT Жыл бұрын
Sir, Your are the best to visualize DSA, Thank you very much.
@supriyajha78236 жыл бұрын
Great explanation! I finally completed one topic properly :)
@daviddelgado659911 ай бұрын
every day I get more impressed of the knowlegde of this guy
@nox9765Ай бұрын
Sir Bari you are the GOAT!!!!
@nabhpatel304012 күн бұрын
Timestamps 00:01 - Matrix Chain Multiplication is about multiplying matrices and finding the number of multiplications required. 02:29 - Matrix multiplication involves choosing the optimal way to parenthesize matrices. 04:55 - Dynamic programming is an efficient method to try out all possibilities and pick the best one 07:33 - Matrix Chain Multiplication involves finding the cost of multiplying matrices 10:26 - Matrix Chain Multiplication - Dynamic Programming 13:36 - The minimum cost for matrix chain multiplication is 1 16:28 - Matrix chain multiplication formula is M[i][j] = min(M[i][k] + M[k+1][j] + d[i-1]*d[k]*d[j]) 19:13 - Matrix Chain Multiplication follows a specific formula and determines the order of multiplication. 21:42 - Matrix chain multiplication is an n^3 operation, solving the parent isolation problem.
@raviraj82096 жыл бұрын
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.
@evanverma13168 ай бұрын
Mr. Bari has anyone ever told you that you are a suave man because you are!
@jimmyp45845 жыл бұрын
So thankful to you sir for explaining such complex topics so easily. Thank you very very much.
@RebeCcaHarOon6 жыл бұрын
Thank you sir. I've learned a lot from your videos. Keep teaching us.
@giornogiovanna9378 Жыл бұрын
for those who still no understand how S is filled: just check the variable number which comes before the multiplication (not counting multiplication inside brackets) if (A2*A3)*A4 then we can see multiplication symbol is after A3 and therefore the value to be filled in S will be 3 ^ (not counting multiplication symbol inside brackets) in [ A1 * A2 ] * [ A3 ] the * symbol comes after A2 thus s value will be 2 this is the easiest way I could think of
@aoyukialquen283511 ай бұрын
im confused on T(n) = 2n Cn / n+1. What is Cn? What does it do? (minute 4:40) Thank you
@vathsavaidhruthi12606 ай бұрын
if you are wondering abt s table .those are the values of k used to get minimum
@piyushanayak4 ай бұрын
Thankyou sir. May God give you ultimate happiness.
@shreyashankar79553 жыл бұрын
Thank you sir your videos helped me understand the concept.
@prasannareddyisireddy82336 жыл бұрын
Thank you sir!! Clear explanation without unnecessary information!!
@Ashishhd75 жыл бұрын
Sir , Your way of teaching is very nice .
@pritpatel42985 жыл бұрын
Are sir aap Kya padhate ho ....ek dum chumma😍😃.....ek hi bar main samj aa gaya☺
@danishiqbal98266 жыл бұрын
Respect respect.. Sir u saved me and i took victory from judgment day (exam) :) : p
@UmangMundhara6 жыл бұрын
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 :)
@bancrusher2 ай бұрын
The value 𝑆 [ 1 ] [ 3 ] = 2 , S[1][3]=2 means that the best place to split the sequence of matrices 𝐴 1 , 𝐴 2 , 𝐴 3, to (A 1 ,A 2) ,A 3 to minimize the multiplication cost is after the second matrix, dividing the problem into two subproblems: ( 𝐴 1 𝐴 2 ) (A 1 A 2 ) and 𝐴 3 A 3 .
@william03776 жыл бұрын
way better than my professor's teaching, thank you
@sheikhaman62184 жыл бұрын
My eager to learn and this KZbin algorithms brought us together
@NavidullahMuradi Жыл бұрын
Thank you sir, this is the best algorithm lesson that I have learned.
@pratikgupta5346 жыл бұрын
You forgot to explain how you're filling the S matrix.
@RamkrishanYT5 жыл бұрын
Yes. It will be the value of the minimum term's 'k'
@jdurefaccini5 жыл бұрын
At the end of the video he explains how do you read the S matrix and there you really understand how he filled it.
@tamzidmahmud61295 жыл бұрын
This video refers to the logical explanation of the above one kzbin.info/www/bejne/lYjRlKieiK-Nr6M .There you will get the logic behind filling the S matrix
@wrestling_hd_core66183 жыл бұрын
Sir u r my savior, I love the way u explain its soooo simple and informative
@softwareengineer8923 Жыл бұрын
Such an amazing and lucid video as usual!
@venky38675 жыл бұрын
Sir you're God Thanks for explanation
@nibeditamisra89995 жыл бұрын
I guess the S table is getting filled by the value that is on the right of first pair of minimum solution. For example at 14:01 the minimum value is given by 2nd option. 2nd option is (A2.A3).A4 . Here 3 is being considered. Second value of the first pair. Similarly at 17:15 minimum solution is given by m[1,3]+m[1,4]+5.2.7 . Here 3 is considered. Second value of first pair.
@AnkitTiwari-lf4gb Жыл бұрын
Bro it is value of k it is filled by value of k at which value of k is given the minimum no. Of multiplication
@milicamisic40112 жыл бұрын
awesome video, much better than my college lessons, thank a lot ❤
@alex-ek8vt3 жыл бұрын
Daniel Jung from India. Well done :D
@IamAnsumanDas6 ай бұрын
Thank You Sir for your simplified explanation.
@AbulAlArabi072 жыл бұрын
Thanks a lot for such a video. Saved my tons of time. I wish my instructor was like you
@damansaroa3 жыл бұрын
He teaches with so much patience...
@shauryaawashti94728 ай бұрын
Sir this video changed my life💀💀💀💀 I love you sir🥰🥰🥰🥰😍😍😍😍😻😻😻😻💘💘💘💘💝💝💝💝💖💖💖💖💗💗💗💗💓💓💓💓💞💞💞💞❣❣❣❣
@dineshbh38375 жыл бұрын
At 21:35 Time complexity is not Theta, it is the worst case time complexity so it should be ' big O'
@patchworky3 жыл бұрын
This has been a godsend, thank you so much!
@sicals17206 жыл бұрын
This guys needs to be in youtube rewind
@sicals17206 жыл бұрын
Thank You for your video Sir,
@SzulcMarcin4 ай бұрын
Thank you sir, this explanation was amazing!
@ubaidhunts2 жыл бұрын
s matrix not explained properly
@aryansrikumar3473 ай бұрын
He explained it properly
@umangsomani72242 ай бұрын
Bakchodi mat de
@amindalvand99654 күн бұрын
Forget about that matrix. Just set the parentheses due to the chosen minimum equation from the smallest to the biggest
@laxmanchoudhary23676 жыл бұрын
Best explanation, twist i like after 19:20 about table S
@Minecraft-hl2ik Жыл бұрын
Why I'm writing that, I'll explain after sometime😁.... Thank You so much sir
@arpansaha73694 жыл бұрын
Sir, would you plz explain the method for filling up the "s" table as you are not using a constant rule here.
@ediellopez17185 жыл бұрын
Phenomenal explanation, sir! Thank you!
@muzammilmueen34876 жыл бұрын
A better explanation to the problem than my professor at Georgia Tech ..
@priyankamanna45503 жыл бұрын
Sir teaching method is great please make more videos on programming concepts 🙏
@zamirmushtaq29112 жыл бұрын
excellent way of communication sir.
@swapnilmahmud77466 жыл бұрын
I’m from bangladesh.Sir you are best.
@ethanbai57125 жыл бұрын
Amazingly explained! Thank youso much!
@宋泰官-h4w6 жыл бұрын
very good! I was confused when reading this topic in an algorithms book. it helps me a lot! Thank!
@anayaanson80954 жыл бұрын
Really a good explanation... Really helped me... Thanks 4 this good explanation video... 😊
@CryptosFX3 жыл бұрын
Construct the m and s tables by Matrix Chain Multiplication for n = 6 using dynamic programming technique based on following matrix dimensions. Hint: by using recurrence relation formula, compute minimum cost of each cell in memorization table. Matrix. Dimensions A1. 30*35 A2. 35*15 A3. 15*5 A4. 5*10 A5. 10*20 A6. 20*25 What is tha answer?