34 Matrix Chain Multiplication Recursive

Поділитися
Вставка
  • Опубліковано 4 лют 2020
  • Matrix Chain Multiplication using Recursion
    Given a sequence of matrices, find the most efficient way to multiply these matrices together. The problem is not actually to perform the multiplications, but merely to decide in which order to perform the multiplications.
    PROBLEM STATEMENT LINK:www.geeksforgeeks.org/matrix-...
    Playlist Link: • Dynamic Programming | ... .
    ------------------------------------------------------------------------------------------
    Here are some of the gears that I use almost everyday:
    🖊️ : My Pen (Used in videos too): amzn.to/38fKSM1
    👨🏻‍💻 : My Apple Macbook pro: amzn.to/3w8iZh6
    💻 : My gaming laptop: amzn.to/3yjcn23
    📱 : My Ipad: amzn.to/39yEMGS
    ✏️ : My Apple Pencil: amzn.to/3kMnKYf
    🎧 : My Headphones: amzn.to/3kMOzM7
    💺 : My Chair: amzn.to/385weqR
    🛋 : My Table: amzn.to/3kMohtd
    ⏰ : My Clock: amzn.to/3slFUV3
    🙋🏻‍♀️ : My girlfriend: amzn.to/3M6zLDK ¯\_(ツ)_/¯
    PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.

КОМЕНТАРІ • 373

  • @biswajitsahoo1456
    @biswajitsahoo1456 3 роки тому +287

    (1)= Intro
    (2)= knapsack Intro
    (3-12)= 0-1knapsack
    (13-17)= Unbounded knapsack
    (18-25)= Longest Common Subsequence types
    (26-32)= Longest Palindromic Subsequence types [part of LCS]
    (33-45)= Matrix Chain Multiplication
    (46-50)=Binary Tree regarding DP

    • @ytg6663
      @ytg6663 2 роки тому +2

      Bahut bahut dhanyawad

    • @gunjanshinde396
      @gunjanshinde396 2 роки тому

      Helped 👍🏻

    • @divyanshuupadhyay9831
      @divyanshuupadhyay9831 2 роки тому +11

      what about the other parents Q he talked about in 1st video LIS, kadane's algo, DP on grid, Fibonacci ..

    • @TheBillionairesWorld
      @TheBillionairesWorld Рік тому

      @@divyanshuupadhyay9831 yeah same doubt

    • @prodev08
      @prodev08 Рік тому

      itna berozgar hai bhai tu ki yehi sab karte rahta hai

  • @sujankumarpatro3946
    @sujankumarpatro3946 2 роки тому +37

    Correction:
    07:22
    The value is actually 27,000. So making (ab)c the smaller and preferable choice at 4500. Everything else is same, just the choice will be different...
    Thanks

  • @mradulagrawal1579
    @mradulagrawal1579 3 роки тому +208

    Despite of the hold on concept what makes this channel standing out to others is the energy level and enthusiasm of bhaiya unlike most of other youtube channels where they all sound sleepy or dead. Thanks alot

    • @ytg6663
      @ytg6663 2 роки тому +1

      Fir bhi app english me Likh rhe ho🙄

    • @mradulagrawal1579
      @mradulagrawal1579 2 роки тому +2

      @@ytg6663 what it has to do with english?

    • @ytg6663
      @ytg6663 2 роки тому +6

      @@mradulagrawal1579 placement ho gya kya ye btao

    • @mynk_rjpt
      @mynk_rjpt 2 роки тому +1

      @@ytg6663 lol

  • @rishabsharma5307
    @rishabsharma5307 3 роки тому +191

    At i == j the cost is zero not because there's only one element in the array. It'll be because there's no other matrix to which the remaining matrix will be multiplied
    Ex. [10, 20]
    Here i = 1, and j = 1. So, there's only one matrix in the array and no other matrix to which this matrix can be multiplied. So, there will be no multiplication, hence the cost of multiplication becomes zero

  • @udaykumar-iu2ok
    @udaykumar-iu2ok 4 роки тому +129

    Thank you so much ...this DP series is helping me a lot 😊

    • @TheAdityaVerma
      @TheAdityaVerma  4 роки тому +37

      I am glad it helped you!! Help this channel grow by sharing it so that this content can help more students like you !!

  • @Arjun69
    @Arjun69 3 роки тому +150

    Coding Ninja is showing their add on this video.
    Lol , as if I will buy any course after experiencing how Aditya teach.

    • @TheAdityaVerma
      @TheAdityaVerma  3 роки тому +62

      haha 😂😂 poor them 😅

    • @mohdsaif7834
      @mohdsaif7834 3 роки тому +48

      I am coding Ninja employee reading this lol .. :)

    • @anubhavgupta4917
      @anubhavgupta4917 3 роки тому +2

      @@mohdsaif7834 sam here 😅

    • @rudra4830
      @rudra4830 3 роки тому +5

      @@mohdsaif7834 learning how to teach mcm in true way

    • @AmitSingh-nf2fz
      @AmitSingh-nf2fz 2 роки тому +2

      @@mohdsaif7834 so what?? He teaches far better than coding ninjas!!!

  • @0anant0
    @0anant0 3 роки тому +66

    33 of 50 (66%) done! A long video, but was worth it to understand the range of k. I have seen many versions, some using gradually incr len of sliding window, etc., but this one is more clear. I use terms lo and hi instead of i and j for easy readability.

    • @thinkingmad1685
      @thinkingmad1685 2 роки тому

      Bro for backtracking also tell any series so i can follow

    • @shivamdwivedi3534
      @shivamdwivedi3534 11 місяців тому

      @@thinkingmad1685 kunal kushwaha

  • @pallavirawat7128
    @pallavirawat7128 2 роки тому +26

    These lecture series are like The New Testament of Dynamic Programming. It is going to serve the generations to come. Great work and huge thanks.

  • @MegaSethi
    @MegaSethi 3 роки тому +10

    Your series is the benchmark in explaining dp concept. No one on earth explained it better.

  • @prernacore
    @prernacore 3 роки тому +14

    Sir , you're a LEGEND ! Thank you for helping us .

  • @RitikSharma-pc5yj
    @RitikSharma-pc5yj 3 роки тому +3

    Thank-you so much for all series, especially for making us understand with dry running.

  • @parthsalat
    @parthsalat 4 роки тому +81

    Trust me, this is the *best* matrix chain multiplication dp explanation on the whole internet.
    Can u pls tell where did u learn it from? I just wanted to know whether u learnt from books or some teacher.
    Thanks again!

    • @TheAdityaVerma
      @TheAdityaVerma  4 роки тому +428

      Would you believe me If I say I did that on my own?! Because I did. 😅
      Teacher and books cant teach you the way you want to learn tbh !! Self Study is all that I believe in, so keep digging into stuff, you will learn stuff that no one has ever learned or know of before !! Sometimes you just have to be the person 0, no teachers no books.
      Do share the content to help the channel grow !!

    • @parthsalat
      @parthsalat 4 роки тому +44

      @@TheAdityaVerma Thanks a lot for the reply - it enlightened me!😇
      Will surely share this channel with my whole class👍

    • @ankurkumarupadhayay4304
      @ankurkumarupadhayay4304 3 роки тому +7

      @@TheAdityaVerma bhaiya LIS ka versions ka video bhi upload kar dijiye

    • @princegarg1086
      @princegarg1086 2 роки тому +1

      @@ankurkumarupadhayay4304 code for cause channel py dekho acha smjhaya hein

    • @gilbertjalapeno9221
      @gilbertjalapeno9221 2 роки тому +3

      @@TheAdityaVerma You're the best teacher, I've ever had. Never thought someone would teach me this topic like this, it feels like my college friend is teaching me, in fact even better.

  • @MASTER0123TBG
    @MASTER0123TBG 4 роки тому +31

    sir i beg you please cover more topics....It's beacause apke saath aisi frequency match ho gyi hai that i cannot even express please please please please...Its a humble request

  • @lakshyamehta7529
    @lakshyamehta7529 3 роки тому +12

    recursion is seriously a magic we are not telling it to multiply a[i-1]*a[i] and it is doing that by itself seriously I am amazed to see recursion!

  • @faizan346
    @faizan346 3 роки тому +1

    i am beginner in competitive programming but after going through this playlist i cant say that anymore.
    THANK YOU bhaaaaai!!

  • @akashsrivastava6281
    @akashsrivastava6281 3 роки тому +5

    You are helping lots of people by teaching the dynamic programming so easily and clearing the concept.

  • @kajalpareek8291
    @kajalpareek8291 4 роки тому +1

    Very nice explanation. Please make a series on strings and graph also as interviews have good questions from these topics. Your way of explaining concepts is really good.

  • @preritjain3980
    @preritjain3980 3 роки тому +1

    I seldom find videos where I understand the concept better than through CLRS. Your MCM video is one such.

  • @abhisheksingh767
    @abhisheksingh767 2 роки тому +3

    On 33 out of 50. Best playlist of DP, best than all free and paid resources available for DP

  • @g1patil
    @g1patil 2 роки тому +12

    Thanks Aditya again. Putting in some simple term that I understood. Taking an example we want to multiple : A*B*C*D*E
    Here K is nothing but a pointer that decided the group split. Imagine that as a pointer in above example and try to split in two groups.
    So first we split the whole thing in groups, and again in small group and so on until we get single valid input, then return that value . Return answer and keep taking smallest from each split.
    Ex :
    Group 1. : A*B
    Group 2 : C*D*E
    so solution will be : Cost of Group_1 + Cost of Group_2 + Cost of Group1 *Group2 .
    We all know that for matrix multiplication : (10*30 ) ( 30*40 ) => 10*30*40 , which is row_group_1 * row_group_2 * column_group_2
    in the recursion for loop, third term is something that will generate the value and return since it has the actual formula of the matrix multiplication of smallest valid input : so recursion(group1) + recursion(group_2) + row_group_1 * row_group_2 * column_group_2 .
    Happy learning :)

    • @mukib_khan_
      @mukib_khan_ 2 роки тому

      Thanks man

    • @legowarrior14
      @legowarrior14 Рік тому

      I understood this expect for recursion(group1) + recursion(group_2). Why did we have to add these?

  • @vasubansal9169
    @vasubansal9169 4 роки тому +186

    @7:23 the value should be 27,000 instead of 2700 I suppose.

    • @desiCatman
      @desiCatman 4 роки тому +10

      18000 + 9000 = 27000 , i also think that

    • @THEkarankaira
      @THEkarankaira 4 роки тому +1

      Yes

    • @shubhamkeshri8430
      @shubhamkeshri8430 3 роки тому +21

      @VASU BANSAL I think you are doing Phd on Mathematical Calculations , You don't worth these level of content.

    • @pavittarkumarazad3259
      @pavittarkumarazad3259 3 роки тому +90

      @@shubhamkeshri8430 Vasu is just pointing out a little mistake. That doesn't means that he don't like the video. So please stop acting like a kid.

    • @ayushnath3768
      @ayushnath3768 3 роки тому +16

      @@shubhamkeshri8430 and i guess you are doing PHD in trolling

  • @shubhamkant_
    @shubhamkant_ 3 роки тому +5

    energy was awesome and loved how you explained every small ( necessary )detail in it. :-)

  • @muditkhanna8164
    @muditkhanna8164 8 місяців тому

    dude your explanation cleaned up my room of dp and now everything is aligned perfectly , before this video i knew MCM ,but it was plastic, now its concrete.

  • @ishagupta7479
    @ishagupta7479 2 роки тому

    Explanation is just amazing seems like my friend is explaining.... I've seen many videos of this topic and all the time I got more confused but on this channel it seems that topic is quite easy..... You are amazing ✌

  • @anuragkothare6181
    @anuragkothare6181 4 роки тому

    Loved your way of Explanation. Simply Good.

  • @sankarkvs918
    @sankarkvs918 3 роки тому +1

    Thanks a lot sir i would have never even touched dp if it werent you. Great work

  • @girishmehra8383
    @girishmehra8383 4 роки тому +10

    Great Work bro...........!Please upload more videos related to dp on grid,kadane's Algorithm,LIS etc.😊😊

  • @satvik_b
    @satvik_b Рік тому

    explained very well from where and till where to run for loop and and value of k. It will be useful in solving other questions as well.

  • @royarijit998
    @royarijit998 4 роки тому +45

    Bhai video dekhne ke baad, I had the 'aha' moment.. Literally how you connect the dots at the end and generalise the concept - you're the best... I'm sharing this with all my friends
    There are so many questions on leetcode that uses this model - burst balloons, minimum cost to merge stones... Aapne toh saare banva diye, jisme pehle kaafi time waste kiya hai maine...
    Thank you so much for this series

    • @TheAdityaVerma
      @TheAdityaVerma  4 роки тому +13

      Thanks Arijit, I just tried to give my best !! Its 1am, I really appreciate the hard work your putting in. Wish you luck brother !!

    • @royarijit998
      @royarijit998 4 роки тому +7

      @@TheAdityaVerma Thank you so much bhaiya, abhi toh aapki poori playlist complete karni hai mujhe!!!
      Saachme best lectures on DP!!

    • @indranilthakur3605
      @indranilthakur3605 4 роки тому

      @@royarijit998 what all questions you found on leetcode related to this?

    • @indranilthakur3605
      @indranilthakur3605 4 роки тому

      @@royarijit998 How did you solve those questions? I tried solving them but getting some error.

    • @paraslaul3307
      @paraslaul3307 3 роки тому

      leetcode.com/problems/burst-balloons/
      @Arijit Roy I am not getting correct ans in this problem .. can you please share your code in this problem?in c++

  • @jsbisht_
    @jsbisht_ 3 роки тому +6

    It took me time to understand how the loop would work to find different cost by looping over k values. If the example taken would have 6 array items instead of 5, it would have been easier to comprehend the loop.
    Enought of the rant. I should admit, I am amazed by how quickly i am going over dp questions. Truely amazing work Aditya. Thanks alot.

  • @ajitdhayal1612
    @ajitdhayal1612 4 роки тому +7

    Congratulations sir on 10000 subscribers😊
    Abhi to bhut aage jana hai!
    Sir recursion or backracking per bhi videos banao na please!!!

  • @RajnishKumar-pr8zx
    @RajnishKumar-pr8zx 4 роки тому +8

    Thank you so much .Plz plz plz continue till all variation of question as you said in this lockdown time .

  • @sleepypanda7172
    @sleepypanda7172 2 роки тому

    phli baar me smjh nhi aaya! Frustration hua par doosri baar patience se suna tab smjh aaya...bht accha explain kia hai bhaiyya ✨✨✨✨✨✨

  • @yatri6329
    @yatri6329 2 роки тому

    Anyone knows why videos are not coming now. His explanation is super best never seen such kind of tutorial. You are the Best. ❤️

  • @high-oncode7576
    @high-oncode7576 3 роки тому +11

    This series is GOAT!

  • @showthecode5223
    @showthecode5223 4 роки тому +3

    I don't know what all I have tried to improve my dp skills but was not able to be confident at it, but this tutorial like really helped me .Thanks a lot ,Keep up the good work

  • @jitendraraghuwanshi8635
    @jitendraraghuwanshi8635 3 роки тому +5

    You're correct when you say "Isse achese shayad hi koi samjha paye"

  • @subashraj3919
    @subashraj3919 4 роки тому

    Beautifully Explained

  • @mrsukki8158
    @mrsukki8158 3 роки тому +8

    For the first time in my life iam watching all the adds that coming in between videos just to support gem of Dynamic programing.❤️
    Just remember his name Aditya verma ❤️....No more words

    • @TheAdityaVerma
      @TheAdityaVerma  3 роки тому +4

      You're Awesome Dude !

    • @AbhishekKumar-im2xd
      @AbhishekKumar-im2xd 3 роки тому +2

      dude..use brave browser ..no ads , it helps to concentrate and you will be watching continuously with full focus on the target.

    • @sayantaniguha8519
      @sayantaniguha8519 3 роки тому

      @@AbhishekKumar-im2xd same

    • @chiragarora870
      @chiragarora870 2 роки тому +1

      @@AbhishekKumar-im2xd you didn't get his point

  • @bharatkumavat3667
    @bharatkumavat3667 Рік тому +1

    this channel deserved at least 1M subscriber.

  • @mdkashifraza2603
    @mdkashifraza2603 2 роки тому +1

    Thank You so much for this amazing Content.

  • @kushalappaca5324
    @kushalappaca5324 2 роки тому

    Thank you. This is the least I can do on all of your videos

  • @shaikzuhair8537
    @shaikzuhair8537 4 роки тому

    Good explanation brother.
    Thanks for making hard topic to very easy

  • @bite091_jamee7
    @bite091_jamee7 2 роки тому

    Without Any Doubt One more amazing Lecture

  • @SonamSharma-ot9uo
    @SonamSharma-ot9uo 3 роки тому +1

    bhaiya u teach far better than gfg wale sandeep sir,means any student can not only learn but also develop the thought process....u r grt bhaiya

  • @NITISHKUMAR-rc4bp
    @NITISHKUMAR-rc4bp Рік тому

    best ever channel for CSE on youtube.☺

  • @aditya_17181
    @aditya_17181 Рік тому +1

    Confidence increasing element you are. Love you

  • @shubhamsingh-ff1cx
    @shubhamsingh-ff1cx 3 роки тому +2

    Aditya Bhai, everything is great in this video each and the way you teach is super excellent. Before I was very scared of recursion and DP. I tended to leave any problem I encounter with DP or recursion. But after watching these videos, I can confidently choose any DP or recursion problem and can try to solve it. Thanks a lot, Bhai.

  • @webdev_telugu
    @webdev_telugu 3 роки тому +28

    14:48 Python coders TRIGGERED!!!!

  • @namanjain6360
    @namanjain6360 3 роки тому +2

    best dp series on UA-cam❤️

  • @grow2024
    @grow2024 2 роки тому

    awesome explanation. Please make videos on other topics as well

  • @viralindian8326
    @viralindian8326 4 роки тому +9

    Never seen this much of clear thinking in programming!

  • @vakhariyajay315
    @vakhariyajay315 Рік тому +1

    Thank you very much. You are a genius.

  • @sarthakbhatia7639
    @sarthakbhatia7639 3 роки тому +9

    At 25:02 20*30 bhi include hoga.Thanks a lot the video.Really helpful

    • @shivajipatil5662
      @shivajipatil5662 Рік тому

      But loop k = i+1 se start hoga, aur a[i] = a[i-1] *a[i]

  • @princesaini9580
    @princesaini9580 3 роки тому

    Bhai Mja aagya.... I regret why didn't I find you early....

  • @jitendraraghuwanshi8635
    @jitendraraghuwanshi8635 3 роки тому +1

    If you're taking j=sizeof(arr) then k

    • @gregbg3200
      @gregbg3200 6 місяців тому

      yeah why is that in the video he clearly took j as the last element in the first approach

  • @keshavshinde8886
    @keshavshinde8886 4 роки тому +1

    Thank you lot of sir this video series really lot of help me for doing competitive programming 😇😇😇

  • @ShreyaSingh-vr9qi
    @ShreyaSingh-vr9qi 4 роки тому +4

    Nicely explained bro !!

    • @TheAdityaVerma
      @TheAdityaVerma  4 роки тому +2

      Thanks brother, Do subscribe and share, that keeps me motivated to do more !!

  • @8Trails50
    @8Trails50 4 роки тому +1

    this guy is a beast

  • @muskanjain4876
    @muskanjain4876 3 роки тому

    Awesome teacher🤗

  • @palakahuja5697
    @palakahuja5697 2 роки тому +1

    can you please make a playlist or graph theory too..it'll be of greattt help !

  • @itz_me_imraan02
    @itz_me_imraan02 3 роки тому +1

    Plz start a series on graph and advanced number theory🙂

  • @night4ury
    @night4ury Рік тому

    In the base condition when i==j, it means that both are representing the same matrix. i.e. There is only one matrix remaining and we require two matrices to multiply.
    Therefore we return 0 when i==j, not because there's one element in matrix.

  • @varunsharma3775
    @varunsharma3775 3 роки тому

    It would be great help if you can explain the question of print parenthesis in MCM like what changes to be made.Thanks in advance! :)

  • @tanmaytyagi7031
    @tanmaytyagi7031 2 роки тому +2

    can't we make (using extra space) pairs of all the Ai 's such that each pair contains row and col details of the matrix, and then apply the solve function?

  • @najimali32
    @najimali32 4 роки тому +37

    Never thought that the balloon bursting problem was actually a variation of MCM.

    • @TheAdityaVerma
      @TheAdityaVerma  4 роки тому +19

      Yeah it kind of is !! It was in my list, but had to drop it off due to time shortage.

    • @najimali32
      @najimali32 4 роки тому +13

      @@TheAdityaVerma are you planning to make video on LIS ??

    • @atharvjoshi682
      @atharvjoshi682 3 роки тому

      @Najim Choudhary is word break also a variation of mcm?

    • @voldemort576
      @voldemort576 3 роки тому

      @@atharvjoshi682 yeah it can be done using that

  • @anuragsharma3757
    @anuragsharma3757 3 роки тому +1

    Value of k will be in range i to j as range function in python doesn't take last value into account.
    So. for k in range(i,j):
    temp = solve(arr,i,k)+solve(arr,k+1,j)+arr[i-1]*arr[k]*arr[j]

  • @vishaldas7142
    @vishaldas7142 2 роки тому

    Thank You For This Vedio!!!

  • @vikramrathore9702
    @vikramrathore9702 3 роки тому

    Love you ❤️❤️ Sir

  • @editorera239
    @editorera239 2 роки тому

    chilla chilla kr saari scheme btadi sr apne!

  • @mukib_khan_
    @mukib_khan_ 2 роки тому +4

    For every call value of mn will be INT_MAX so how the value of mn will be updated since the min function is comparing INT_MAX and tempAns value everytime?

    • @gregbg3200
      @gregbg3200 6 місяців тому

      i think think the INT_MAX is only for 1st iteration of for loop, basically the whole finding minimum process is only for comparison among the iterations of the for loop at every level of recursion

  • @vireshgupta7508
    @vireshgupta7508 3 роки тому +3

    please also make a tutorial on how you rotate your pen on fingertips..

  • @balipavankalyan5008
    @balipavankalyan5008 4 роки тому +2

    #python program
    #Matrix chain multiplication(Recursion):
    import sys
    a=[40,20,30,10,30]
    i=1
    j=len(a)-1
    def mcm(a,i,j):
    if i>=j:
    return 0
    mi=sys.maxsize
    for k in range(i,j):
    temp=mcm(a,i,k)+mcm(a,k+1,j)+(a[i-1]*a[k]*a[j])
    if temp

  • @uptonogood300
    @uptonogood300 2 роки тому

    Gadar cheez h bhai ye MCM to 🤯

  • @pranshu_awasthi
    @pranshu_awasthi 2 роки тому +5

    At 21:34 , from k+1 to j , I think we'd have 3 Matrices namely [ 20 x 30 ] , [ 30 x 10 ] , [ 10 x 30 ] , Similarly at 25:07 too.
    Kindly correct me if wrong.

    • @leom9149
      @leom9149 2 роки тому

      I too had the same doubt

    • @khushwantkumar800
      @khushwantkumar800 2 роки тому +1

      Ai = arr[i-1] * arr[i]

    • @ritikashishodia675
      @ritikashishodia675 2 роки тому

      K+1=3 then from k=3 to 4 there are two matrix

    • @shivajipatil5662
      @shivajipatil5662 Рік тому

      21: 34 yes we have 3 matrices but at 25:07 ig we have only two because the loop starts from k = i+1 , so 30*10 and 10*30

  • @RohitSingh-hc8yi
    @RohitSingh-hc8yi 27 днів тому

    awsome video

  • @tanmayjain5821
    @tanmayjain5821 4 роки тому

    nice explanaion

  • @ayushjaiswal6317
    @ayushjaiswal6317 Рік тому

    19:48 A video on how to roatate pen like Aditya Verma is much needed !!

  • @aditya_17181
    @aditya_17181 Рік тому +1

    Kya batate ho aap wow!!! Love you. #dpking

  • @akashninave5001
    @akashninave5001 3 роки тому

    thank you sir

  • @oqant0424
    @oqant0424 2 роки тому

    Thanks !

  • @pradyumnverma1613
    @pradyumnverma1613 Рік тому +1

    Everything is good bro, concepts are good, explanation is good, methods are good except arrogance. Like I am best others can't teach you better than me.

    • @yathartharora6096
      @yathartharora6096 Рік тому

      Bro 23:38 pe 10*30 vali matrix kyu aa rahi h ?it reaches the end so NULL nhi hoga..
      please tell

  • @nimishgupta8357
    @nimishgupta8357 3 роки тому +5

    @24:15
    The example you have taken for that when we call k+1 to j there k+1 which becomes "i" for the next rec call becomes equal to "j" which is taken care by the base condition. so can we not make it till j-2 since the one we took was redundant

    • @debajyotideba5001
      @debajyotideba5001 3 роки тому +1

      I have same doubt, please clear my doubt if you can🙏

    • @saimahasan7322
      @saimahasan7322 2 роки тому

      Recursion return kaise karega phir... Bas condition pe return karta hai

  • @prerakmodia8562
    @prerakmodia8562 2 роки тому +1

    Fucking Great Playlist!!!
    Best one ever.
    Keep up the good work.

  • @divineforever8691
    @divineforever8691 3 роки тому +1

    one thing when i=j that doesnt means we have size=0 , will that doesn't mean that we got only one element and thus zero operations required .. correct me if I m wrong

  • @curiossoul
    @curiossoul 2 роки тому +1

    I have a doubt, when you set k =I+1, and break
    i -> k-1
    k->j
    Here since i started from 1, zeroth index value in array will be missed, since first partition will only cover 1-1 not 0-1 indexes.
    Am I missing something

  • @krushnachandramaharana5426
    @krushnachandramaharana5426 2 роки тому

    sir ji ap ki video dek ke to DP acha hogeya au pen ghumana bi ache se shik geya .😀😀

  • @vinayverma8897
    @vinayverma8897 2 роки тому +7

    Shouldn't we declare the mn=INT_MAX globally?
    I am getting confused that mn will get initialized to INT_MAX in every recursive call then how can it keep the track of minimum value?

    • @utkarshjaiswal7224
      @utkarshjaiswal7224 2 роки тому

      Ya same doubt

    • @jackwalker2947
      @jackwalker2947 2 роки тому +4

      Just think in this way that after all the function calls when the control will come to taking min for the last function in the stack it will take min value and return that value to second last function which is waiting for its child to finish , after getting the min value from its child it will also do the same thing and finally the function called from main will return the ans
      You cannot declare globally because for every function call you are not getting the value of temp ....since temp is dependent on its child function calls ....first time temp will hold any value is when the last child finishes its call.
      Hope you get it.....keep learning 😀

  • @prashantmaurya9635
    @prashantmaurya9635 2 роки тому

    nice solution

  • @lifehacks9450
    @lifehacks9450 4 роки тому

    nice one

  • @omkarvashistha2400
    @omkarvashistha2400 2 роки тому +2

    I have been watching all your vids in x1.75 now your normal voice sounds so strange to me

  • @pranjalgupta9427
    @pranjalgupta9427 3 роки тому +1

    Thanks bhai ❤

  • @divyanshmishra5121
    @divyanshmishra5121 10 місяців тому

    started first video on 30.01.2023. watching this on 22.08.2023. Will finish the whole playlist before sleeping today.

  • @LearnCodeHS
    @LearnCodeHS 2 роки тому

    Please make a video on Soduko solving problem

  • @NotNotNithin
    @NotNotNithin 3 роки тому

    Just one doubt. Shouldn't there be no "loops" used in a recursive solution? Am I missing something here!? Please let me know.

  • @ritikagupta8847
    @ritikagupta8847 3 роки тому +1

    Why we are concerned with minimizing only multiplication operations in the multiplication of 2 matrices? Is it because it is a costlier operation than +? or multiplication happens more times than addition?

    • @NareshKumar-dw9xp
      @NareshKumar-dw9xp 3 роки тому

      Because multiplication varies according to their order but addition and subtraction is just fixed ... you can change their order of addition but their is no changes occurs in the result. So, I think it's worth enough to calculate the right approach for multiplication .

  • @biswajitsahoo1456
    @biswajitsahoo1456 3 роки тому

    jahapanah tussi great ho

  • @bhatipradeepsinghsurendras7257
    @bhatipradeepsinghsurendras7257 3 роки тому +13

    why cant we have k= i to j. Bcz when we can have answer as (ABCD) and condition i>j will automatically give answer 0 when k+1 > j

    • @chiragarora870
      @chiragarora870 2 роки тому +2

      Because in that case recursion will bring you back to the same bigger problem and it will result into stack overflow error

  • @ritikashishodia675
    @ritikashishodia675 2 роки тому

    Vha bhaiya kya pdate ho 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥✌✌✌🙂🙂🙂🙂🙂🙂🙂🙂🔥🔥🔥🔥🔥🔥thank u so very much .

  • @gauravshukla6675
    @gauravshukla6675 2 роки тому

    before watching the video my thought was this video is too long for the question and after watching this video my reaction was how can someone tech all these concepts in just 40 minutes...great video💓💓💓