2.4.2 Examples for Master Theorem #2

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น • 130

  • @andrewescu
    @andrewescu 3 ปีที่แล้ว +69

    I think what makes Mr. Abdul Bari such a great teacher is the fact that he understands sometimes it is more effective to show someone how to do something rather than merely tell them how to do it. College lectures a lot of the time are way too much telling and not nearly enough showing.

  • @antonstarostin4876
    @antonstarostin4876 5 ปีที่แล้ว +6

    Thank you for your videos!
    For everyone else who was puzzled by the example at 1:31, here is the analysis:
    T(n) = T(n/2) + n
    log 2 (1) => log from 1 base 2 = 0
    K = 1
    There is no log^p (n) here, so assume p = 0.
    P = 0 (log^0(n))
    (log < k) then it's case 3.
    This corresponds to option 1 (p >= 0).
    Therefore the answer is O(n^k log^p (n)). Apply our variable and get O(n^1 * log^0(n)).
    I saw several people asked the same question and this comment originally was pretty much the same, but finally, I realized that I was wrong :)
    Thank you again!

  • @janlycka9622
    @janlycka9622 4 ปีที่แล้ว +23

    Best ending - "That's all" :D. Very useful video, thank you

  • @krishnakabi9957
    @krishnakabi9957 4 ปีที่แล้ว +17

    I am very much grateful to you sir. Earlier I was very scared to even tap into this subject. I always thought the concepts are too tough. But you made it spectacularly easy. I am currently doing masters but don’t have CS background so I make sure I watch your videos thoroughly before attending my instructor’s lecture. You make these concepts relatively much easier. Thank you so much 😊

  • @mvbmartins2008
    @mvbmartins2008 2 ปีที่แล้ว +6

    Thank you very much.
    Your explanation turned it easily than I had learned before.
    It is the power of internet.
    If i had not found you, my path would be to much hard than it really was.

  • @umeshmadushanth2878
    @umeshmadushanth2878 4 ปีที่แล้ว +4

    Super explaining sir, explanation is more than crystal clear
    Understanding level is 1000%
    Thank you very much sir
    I felt much easier after watching these videos

  • @subramaniyanvg6367
    @subramaniyanvg6367 4 ปีที่แล้ว +5

    Best examples I get confused when I try to solve some equation on my own. But worth it thanks sir.

  • @sahil_more
    @sahil_more 4 ปีที่แล้ว +23

    RESPECT ++10,000
    Honestly SIR your style of teaching is Super Awesome.
    Thank you very much.

  • @richardholdbrook9067
    @richardholdbrook9067 ปีที่แล้ว +2

    You are a very good teacher. It is 2023 and you are saving my semester. Thank you so much.

  • @itsmeakash_
    @itsmeakash_ 2 ปีที่แล้ว +4

    Just by remembering the formulas I can solve them literally in a minutes. JUST WOW

  • @Swansylinks
    @Swansylinks 3 หลายเดือนก่อน

    You're my saviour from this course. May God increase you in all ramifications.

  • @MrColonelexe
    @MrColonelexe 4 ปีที่แล้ว +5

    Thank you.. This video give me so much clarity than what my lecture did.

  • @iqra817
    @iqra817 4 ปีที่แล้ว +8

    Thank you so much Sir.
    For making tough subjects easy to learn.

  • @golubhattuk01
    @golubhattuk01 8 หลายเดือนก่อน +2

    sir never asked to people to subscribe , people who respect his knowledge , and have brain subscribe by theirself

  • @aliwahid
    @aliwahid 3 ปีที่แล้ว

    you are a wonderful teacher
    i hope i have teacher like you on all my subjects

  • @varunchhabra9704
    @varunchhabra9704 6 ปีที่แล้ว +2

    Thank You very much!!! All your videos on DSA are very informative and valuable.

  • @vakhariyajay2224
    @vakhariyajay2224 2 ปีที่แล้ว +2

    Thank you very much. You are a genius. 👍👍👌👌🔝🔝🙏🙏

  • @AdityaGupta-zd5sq
    @AdityaGupta-zd5sq 3 ปีที่แล้ว

    very good explanation all school of computer science student should watch this playlist to strong the concept of design and analysis of algorithm..

  • @usamaalioffical
    @usamaalioffical 5 ปีที่แล้ว +2

    You are the God of Algorithms.Your name should come in Guiness Book of world records for teaching best course on algorithms free of cost.May God Bless you and give you long health.Lots of Love and Best Wishes from Pakistan
    One suggestion to give you...Kindly add code of algorithms in your videos and explain them and also should discuss what type of questions can come in paper from these algorithms.I am talking about exams in university

  • @jithinmv6516
    @jithinmv6516 5 ปีที่แล้ว +5

    in case 3 last example, we should take Big-OH notation right?

  • @fantasy9960
    @fantasy9960 2 ปีที่แล้ว +1

    Thanks!

  • @W1LDGAMING.
    @W1LDGAMING. 5 ปีที่แล้ว +3

    Thank you sir for making video on master's theoram ...

  • @JyotiSharma-wb1vy
    @JyotiSharma-wb1vy 3 ปีที่แล้ว

    Thank You so much sir! Only because of you i am to solve these questions with clarity.

  • @aditi3586
    @aditi3586 ปีที่แล้ว +1

    sir what are we supposed to do if t(n) = t((n)^(1/2)) is given? How do we tackle the root in the RHS? Thanks!

  • @confessions92
    @confessions92 6 ปีที่แล้ว +4

    Thank you so much for all your videos!!

  • @JackyShaw
    @JackyShaw 5 ปีที่แล้ว +4

    Sir case 3 me when p

    • @rishabjain4019
      @rishabjain4019 4 ปีที่แล้ว

      in these cases you can take theta or big O .both are same

  • @Mvs_haitus
    @Mvs_haitus 4 ปีที่แล้ว +1

    Sir, what would be the time complexity if the question is T(n)=9T(n/3)+n^2/log^2(n)?

    • @zyan786
      @zyan786 3 ปีที่แล้ว

      O(n^2) / theta(n^2)

  • @omprakash007
    @omprakash007 6 ปีที่แล้ว +2

    sir in this very first example answer is of order "n" but same problem in previous video have order of "nlogn" how????
    please explain.

    • @anirudh4465
      @anirudh4465 4 ปีที่แล้ว +1

      @om prakash No its the same , please check again

  • @ufkun20
    @ufkun20 4 ปีที่แล้ว

    Very straightforward, many thanks

  • @surajkumar-px5lf
    @surajkumar-px5lf ปีที่แล้ว +2

    I got more respect for you sir. It's 3 am

  • @geraldlim1796
    @geraldlim1796 5 ปีที่แล้ว +1

    may I know what about T(n) = T(n/2) + 2^n? Which case does it belong to?

    • @geraldlim1796
      @geraldlim1796 5 ปีที่แล้ว +1

      @@abdul_bari Hi sir, I have found logab to be 0, but what is the k and/or p value for 2^n?

    • @polinez149
      @polinez149 ปีที่แล้ว

      i have the same problem

  • @varunchhabra9704
    @varunchhabra9704 6 ปีที่แล้ว +3

    I am struggling to find the complexity of :
    T(n) = 16T (n/4) + n!
    Its a frequently asked question on various forums.But lacks a conclusive answer.
    I will appreciate if you can break it down using Master Theorem

    • @varunchhabra9704
      @varunchhabra9704 6 ปีที่แล้ว

      I am little confused in this example.
      T(n)= 16T (n/4) + n!
      In order to use master Theorem, we compare it with following form:
      T(n)=aT(n/b) + theta ( n^k logn^k)
      So my question changes to :
      T(n)=16T(n/4)+ theta(n!)
      However, in last videos, you explained that there is no tighter bound for n!. So we take upper bound and change it to n^n
      T(n)=16T(n/4)+ theta(n^n)
      Now. a=16 , b=4 , k=n
      This implies log a base b= 2 and k=n.
      Now how do I compare them to arrive at one of the master theorem cases?????

    • @varunchhabra9704
      @varunchhabra9704 6 ปีที่แล้ว

      The question is how do we say that:
      2

    • @varunchhabra9704
      @varunchhabra9704 6 ปีที่แล้ว

      I watched your videos very sincerely and I am able to solve almost all the questions.However this particular question is baffling me.
      I hope as a teacher you can simplify and explain to students like us.

    • @varunchhabra9704
      @varunchhabra9704 6 ปีที่แล้ว

      Thank you sir....I did not analyze the relation between a constant and n
      Can I say that when the f(n) does not have theta (tighter bound)....we will use its upper bound?? Just like in this case n! did not have tighter bound so instead we used n base n

    • @Manisha-lp3en
      @Manisha-lp3en 4 ปีที่แล้ว +1

      @@varunchhabra9704
      1. 16T(n/4)------> n^2
      2. n! ----------------> n!
      We can't able to compare both
      Note : For n! We can't able to compare unless we know the value of n
      Ans: Unpredictable
      Hope it clarifies ur doubt

  • @ravisoni-hr5kf
    @ravisoni-hr5kf 6 ปีที่แล้ว +3

    What is the complexity of this function:-
    T(n) = 8T(n/4)+ n^2
    Plzz give the answer

    • @harshmk1052
      @harshmk1052 5 ปีที่แล้ว +2

      @@abdul_bari hello sir.
      In this particular question the complexity is coming n^1.5.
      so can we round it off to n^2 and that's why you had written n^2 in the reply ?
      please clarify.
      thank you sir in advance :)

    • @harshmk1052
      @harshmk1052 5 ปีที่แล้ว +1

      yes sir .
      i got it .
      thanks for clearing the doubt :)

    • @venkatesan_muniappan
      @venkatesan_muniappan 4 ปีที่แล้ว

      I guess the answer will be BigO(n^2) because log of 8 with base 4 is less than 2, and according to the case 3, we get n^2.

    • @kalnymal9712
      @kalnymal9712 4 ปีที่แล้ว

      Input: a = 8, b = 4, k = 2, p = 0
      1. log(b)a = 1.xx, k = 2, p = 0
      2. This is case 3.1 (1.xx < 2 and 0 >= 0)
      3. take the f(n)
      Output: n^2

    • @TY-xj5hm
      @TY-xj5hm 4 ปีที่แล้ว

      O(n^2) look at -> case 3 episode 2

  • @colly9888
    @colly9888 2 ปีที่แล้ว

    Thank you. I can sleep tonight.

  • @alexanderkononenko6458
    @alexanderkononenko6458 20 วันที่ผ่านมา

    Can u please check: for example
    3T(n/3) + n^2.
    so we have „case 3“ and we checke different between f(n) und Omega ^y+є.
    f(n) = 2 , Omega = 1. but 1+є , for є=0.1. so f(n) = 2 > 1.1 . It’s true what I mean and try to solve ?

  • @aanchalverma1434
    @aanchalverma1434 4 ปีที่แล้ว +2

    Hlo sir.
    T(n) = T(n/2) + 2^n
    How to solve this relation

  • @paulsnehasish5830
    @paulsnehasish5830 3 ปีที่แล้ว +2

    Not all superheroes wear capes.....some wear white shirts

  • @ekanshmishra4517
    @ekanshmishra4517 4 ปีที่แล้ว +1

    t(n)=t(n/4)+t(n/2)+n^2 how to solve these type of equation of complexity analysis?

  • @bigmouth_5
    @bigmouth_5 4 หลายเดือนก่อน

    case 3 mee thum big "o(n2)" raknahe sir

  • @Han-ve8uh
    @Han-ve8uh 4 ปีที่แล้ว +1

    Anyone has traced by tree/substitution Case 2: p=-1 or p

  • @hayabar4411
    @hayabar4411 หลายเดือนก่อน

    Thank you so much 💓💓💓💓

  • @stephenoosting7880
    @stephenoosting7880 3 ปีที่แล้ว +3

    Would you be my algorithm analysis professor, please? Pretty please?
    I'm guessing probably not. Maybe I can send you some cookies instead. 😃
    Seriously though, I don't understand my professor at all, and our textbook is of limited value on this subject. You have helped me tremendously. Thank you.

  • @gabisaado8132
    @gabisaado8132 ปีที่แล้ว

    Hi, i dont really understand the first and second example in case 2. you said that the example T(n) = T(n/2) + 1, 1 has the exponent 0 but in the 2nd example -> T(n) = 2T(n/2) + n, n has the exponent 1. can u elaborate cause i am confused

    • @MdArman-fe2po
      @MdArman-fe2po 10 หลายเดือนก่อน

      In the 1st example k is 0 and in the 2nd example k is 1 cuz In the 1st example T(n/2) = log 1 with base 2 so its value is 0 In the 2nd example 2T(n/2) = log 2 with base 2 so its value is 1.
      Then put the formula you will understand clearly😅

  • @anubhavsharma6263
    @anubhavsharma6263 4 ปีที่แล้ว

    Can anyone or sir you yourself help me with the example 2T(n/2) + nlgn as you did it by considering it of case 2 while CLRS stated it to be in the gap between case 2 and case 3 as f(n) is larger but not polynomialy larger....
    It would be great help for me I'm stuck.

  • @mohammedadel8948
    @mohammedadel8948 2 ปีที่แล้ว

    Thank you for your hard work.

  • @venumadhav3808
    @venumadhav3808 3 ปีที่แล้ว

    Please let me know about 7t(n/2) +18n2 and n is a power of 2. Request to take odd numbers and explain don't talk eays powers.

  • @ArgyroSyros
    @ArgyroSyros 2 ปีที่แล้ว +1

    how to solve,
    6T(n/3) + n/logn

    • @abdullahh10
      @abdullahh10 2 ปีที่แล้ว

      n^(log(6base3))
      Explanation log(6base3) = 1.63 and k=1 so it is case1 and then take n^(log a base b)

  • @kyokibot
    @kyokibot ปีที่แล้ว

    I know that my ex will always come here because she is studying algo now. I just wanna say, I miss you and I love you to the moon and back. I really do. Keep it up with your studies ok? ❤

  • @saishadlak6129
    @saishadlak6129 5 ปีที่แล้ว

    What should we do in Case of
    T(n) = 2T(n/2) + n^2 + 2 ??

    • @saishadlak6129
      @saishadlak6129 5 ปีที่แล้ว

      That extra +2 .. what to do with that

    • @antonstarostin4876
      @antonstarostin4876 5 ปีที่แล้ว +1

      @@saishadlak6129 I'm not an expert, but I guess we need to ignore + 2 in this particular example and use n^2 to calculate complexity according to the rules defined in the theorem (n^2 will grow every time we increase n, constant will stay the same)

    • @Rahalbro
      @Rahalbro 4 ปีที่แล้ว

      n^2+2 €O(n^2)

  • @AnjaliNanadwal
    @AnjaliNanadwal 2 หลายเดือนก่อน

    Best explanation

  • @Music-hz3os
    @Music-hz3os 2 ปีที่แล้ว +1

    Just WOW!!! Thanks a lot.

  • @bhavyanayyer3391
    @bhavyanayyer3391 3 ปีที่แล้ว

    The last two examples of case 2 are not cleared pls explain?????

  • @WeAsCode
    @WeAsCode 3 ปีที่แล้ว +1

    What if T(n) = 16T(n/4) + n! ?
    In master theorem..

    • @kera2403
      @kera2403 3 ปีที่แล้ว +1

      The point is to eliminate the insignificant term. Here n! will clearly dominate. so the ans is O(n!)

  • @yannrezk5735
    @yannrezk5735 2 ปีที่แล้ว

    we love you ayre bsa3eed

  • @anmolshres
    @anmolshres 4 ปีที่แล้ว

    For the last two examples in case 2, there is a non-polynomial difference between n^(logb(a)) and f(n) so Master Theorem does not apply. Not sure how you derived your final answer there.

  • @travelwithus3732
    @travelwithus3732 5 ปีที่แล้ว +1

    hi thank you so much, how to solve T(n) = 4T(n2
    ) + 2n

    • @邓成-g1m
      @邓成-g1m 5 ปีที่แล้ว

      Because we know log b of base a = 2 and k=1, 2>1, we got case 1. Then O(n^(log2))

    • @rushout09
      @rushout09 4 ปีที่แล้ว +1

      Log a to the base b is 2*log 2 to the base 2. log 2 to thhe base 2 is 1, so we get log a to the base b as 2. So answer in case 1 is n^2

    • @lian3397
      @lian3397 3 ปีที่แล้ว

      In this case, a=4, b=2, k=1, then logb(a) = log2(4) = 2 would be > than k=1
      So answer is n^(logb(a)) = n^2

  • @sevprogramming
    @sevprogramming 3 ปีที่แล้ว

    You are so good!

  • @pawanthanay
    @pawanthanay 6 ปีที่แล้ว

    sir for t(n)=4t(n/3)+n^2 t(1)=1?

    • @pawanthanay
      @pawanthanay 6 ปีที่แล้ว

      Abdul Bari log 4 base 2 is 2
      log 4 base 3 is 1.6

    • @pawanthanay
      @pawanthanay 6 ปีที่แล้ว

      Abdul Bari how?

  • @himanshuranjan657
    @himanshuranjan657 5 ปีที่แล้ว +1

    In case 3 last question there will be big o or theta

  • @swadhindas5853
    @swadhindas5853 4 ปีที่แล้ว

    Sir what is the meaning of log^2(n) ? is it loglogn or (logn)^2 ?

    • @anubhavsharma6263
      @anubhavsharma6263 4 ปีที่แล้ว

      (log n)^2

    • @Manisha-lp3en
      @Manisha-lp3en 4 ปีที่แล้ว

      @@anubhavsharma6263
      1. (log^2)n = loglogn
      2. (logn)^2 = lognlogn
      Both are different
      Hence (log^2)n = loglogn

    • @anubhavsharma6263
      @anubhavsharma6263 4 ปีที่แล้ว

      @@Manisha-lp3en i agree with your point two, but how can your point 1 say that,
      log^(8)(100)=8*log(100)?
      i.e. according to you-
      log raised to power 8 of 100 is equal to 8 times log 100?

    • @Manisha-lp3en
      @Manisha-lp3en 4 ปีที่แล้ว

      @@anubhavsharma6263
      log^(2n).....Any value in the power of log, we multiply tat value with log........
      here ,power=2n, base=2........
      Hence (2n)log 1

    • @anubhavsharma6263
      @anubhavsharma6263 4 ปีที่แล้ว

      @@Manisha-lp3en my friend can you tell me then with your point of view, what should be the answer of log^(3)(10) with base 10, i.e. cube of (log 10 to the base 10)

  • @satabdipalit1955
    @satabdipalit1955 6 ปีที่แล้ว +1

    Hw to solve T(n) =T(n/4)+T(n/2)+(n*n)

  • @starlord2471
    @starlord2471 6 ปีที่แล้ว

    Sir I have a question plzz help -
    T(n) = T(√n) + n logn ????????

    • @anandsuman2012
      @anandsuman2012 6 ปีที่แล้ว

      I think It should come to theta(n*logn).

    • @yashchachad
      @yashchachad 4 ปีที่แล้ว

      For using masters thm b should be greater than 1 , here it's not

  • @NoajmIsMyName
    @NoajmIsMyName 6 ปีที่แล้ว

    case #2 Example Number 6 not sure why (n log n log n) ?

  • @fahimimtiaz2153
    @fahimimtiaz2153 ปีที่แล้ว +1

    Brilliant

  • @stevenha3752
    @stevenha3752 4 ปีที่แล้ว

    Great Video!

  • @rohanjaiswal4313
    @rohanjaiswal4313 2 ปีที่แล้ว

    thank you sir

  • @emreproxtr
    @emreproxtr 3 หลายเดือนก่อน

    Abdul Hoca artık babamdır, üstadımdır.

  • @vinittodai911
    @vinittodai911 3 ปีที่แล้ว

    Legend again!

  • @apandey6249
    @apandey6249 3 หลายเดือนก่อน

    you are god ,god!!

  • @satabdipalit1955
    @satabdipalit1955 6 ปีที่แล้ว

    Thnk u so much sir

  • @amitjoshi8272
    @amitjoshi8272 3 ปีที่แล้ว +22

    GOD has a face

  • @viveksrivastava9138
    @viveksrivastava9138 5 ปีที่แล้ว

    Where the sound??

  • @kedarpednekar9582
    @kedarpednekar9582 5 ปีที่แล้ว

    he is new god !!

  • @gamingworld2320
    @gamingworld2320 6 ปีที่แล้ว

    Sir u have taken log2n and log n whole square as the same thing which is mathematically incorrect

  • @MillionaireMindset580
    @MillionaireMindset580 5 ปีที่แล้ว

    thank you

  • @aminanisarahmad5815
    @aminanisarahmad5815 4 ปีที่แล้ว

    Usefull

  • @shushmitajha1135
    @shushmitajha1135 5 ปีที่แล้ว

    how to solve T(n)=T(n/2)+T(n/4)+T(n/8)+n

  • @uddalokbasak2501
    @uddalokbasak2501 6 หลายเดือนก่อน

    god

  • @Iqbaltabish87
    @Iqbaltabish87 5 ปีที่แล้ว

    Last two example is horrible.

  • @johnyoutube6611
    @johnyoutube6611 ปีที่แล้ว +1

    Thanks!