2.3.1 Recurrence Relation Dividing Function T(n)=T(n/2)+1 #1

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Recurrence Relation for Dividing Function
    Example : T(n) = T(n/2) +1
    explained using Recursion Tree and Back Substitution Method
    Courses on Udemy
    ================
    Java Programming
    www.udemy.com/...
    Data Structures using C and C++
    www.udemy.com/...
    C++ Programming
    www.udemy.com/...

Комментарии • 121

  • @amruteshmishra4921
    @amruteshmishra4921 4 года назад +316

    Thank you sir for reducing my time complexity of understanding time complexity !

  • @akashkirthik9882
    @akashkirthik9882 5 лет назад +5

    Wow ! Nobody would have explained better ! Thank you sir ! Hope you make more videos !

  • @sushantaray9116
    @sushantaray9116 6 лет назад +4

    Sir your lectures are very much easy to understand and also very helpful for gate exam .
    I request you to upload some java tutorial videos ,especially Java Collection

  • @tapasreedey2917
    @tapasreedey2917 3 года назад +1

    thank you so much!!

  • @某李-s8l
    @某李-s8l 4 года назад +2

    太强了 老师!!!

    • @ankitcaring
      @ankitcaring 4 года назад +1

      bro reply in english so that other could understand bcz if u understand this video , u must know englsih

  • @manussa9778
    @manussa9778 4 года назад +2

    Thank you!! God bless you.

  • @subramaniyanvg6367
    @subramaniyanvg6367 3 года назад

    Hats of to you sir awesome explanation .

  • @shwetapriyadarshani197
    @shwetapriyadarshani197 4 года назад

    Very clearly explained sir

  • @codetodecode299
    @codetodecode299 3 года назад

    very well explained

  • @vittoriafrau1857
    @vittoriafrau1857 4 года назад +1

    Sorry to bother you sir (and thanks for the great videos), but for T(1)=0 what's the solution? O(1)?

    • @abdul_bari
      @abdul_bari  4 года назад +8

      yes 0 is constant so T(1) is O(1)

  • @Deadpool-cz6rt
    @Deadpool-cz6rt 2 года назад

    Why are we using T(n) = 1 when n = 1. In previous videos we used, T(n) = 1 when n = 0. So I was wondering how did you figure out which value of n gives T(n) = 1?

    • @user-vv2kr
      @user-vv2kr 2 года назад +1

      This video is for deviding function . In division and multiplication unit or least value is 1. But in addition and subtraction unit value is 0. For previous cases (addition and subtraction functions) we could assign constant for 0 /unit value. Since sir said he prefer to assign 1 since it is also a constant. When we calculating time compexity all the constants can consider as same even though value is different :)

  • @shubham3079
    @shubham3079 4 года назад +9

    sir, i'm having trouble solving this question :-
    T(n) = T(n/2) + T(n/4) + T(n/8) + n
    please give me a hint sir.

    • @vinitraj6268
      @vinitraj6268 4 года назад

      Yes sir please make a video on it.

    • @damonsalvatore8644
      @damonsalvatore8644 4 года назад +2

      ans: big-oh( 7^ log(base8)n )

    • @shubham3079
      @shubham3079 4 года назад

      @@damonsalvatore8644 please explain

    • @damonsalvatore8644
      @damonsalvatore8644 4 года назад +3

      @@shubham3079 Try recursive tree method.
      In the first iteration, the time will be n and in the second iteration, Time will be (7/8)n and then (7/8)^2*n and so on. We can see the pattern as n*(7/8)^k. So the T(n) will be n+((7/8)^1)n+((7/8)^2)n+....+((7/8)^k)n. Take n as common and form a geometric series like n[1+(7/8)+(7/8)^2+(7/8)^3+....+(7/8)^k].
      It is equal to n[(7/8)^k]

    • @damonsalvatore8644
      @damonsalvatore8644 4 года назад +3

      Now,T(n) will be 1 only if n=1...Note:n cannot be 0 here because of T(n/2),T(n/4) and if n==0, n/2^k=0 which gives our n as zero value. So go with n=1. In the given question ,the highest term is (n/8). So T(n)=1 when n/8^k =1 . Therefore k= log(base8)n.We will get T(n)= n[(7/8)^k].WKT n/8^k=1. So,T(n)=7^k which upon applying k value becomes T(n)=7^log(base8)n. Hence the value big-Oh(7^(logn)).

  • @sports-ft9se
    @sports-ft9se 4 года назад

    Sir! T(n/2)=T(n/2)+1 is this right or T(n)=t(n/2)+1 ?

  • @shobhitsrivastava8876
    @shobhitsrivastava8876 3 года назад

    How can I calculate Theta notation using this method.

  • @subhamdudheria9523
    @subhamdudheria9523 2 года назад

    shouldn't this be T(n/2)+2 , as if statement also takes 1 unit of time

  • @TheBardack99
    @TheBardack99 4 года назад +13

    You are my Yoda of the computer science force

    • @sexychantu5066
      @sexychantu5066 3 года назад +2

      AAPKA NAAM KAISE BOLU MAI KUCH SMJ NAHI AARA. IS SE ACHE TO BIOLOGY MAI SCIENTIFIC NAMES HOTE HAI BHAI.
      THANKS AND REGARDS
      SEXY CHANTU

  • @prajan_jana
    @prajan_jana 4 года назад +7

    Sir thank you for sharing this video...sir can you put video for
    1. T(n)=T(n/2)+1. Where n=2↑k for all k greater than or equal to 0...
    2. T(n/3)+T(2n+3)+cn. Where c is constant & n is input size... please sir help me...

  • @LcaptainoftheForsaken
    @LcaptainoftheForsaken 3 года назад +21

    You are absolutely amazing! For so long, I never understood how to do anything related to analysis of algorithms, but now I understand! Thank you so much for spending time with us to teach me what other professors have failed to do.

  • @renasbaran9204
    @renasbaran9204 Год назад +2

    What is the time complexity of this function?
    public static float myst (float q, int n){
    float e = 0;
    if (n

  • @zahreddinesoualem3213
    @zahreddinesoualem3213 3 года назад +4

    sir, I'm so confused, what is the meaning of 1 step of each dividing !! and the level of the tree please these word are really frustrating

  • @victoryosikwemhe3092
    @victoryosikwemhe3092 2 года назад +12

    The way he teaches is so relatable, no hidden magic, he unfolds everything

  • @amazepk
    @amazepk 5 лет назад +3

    Charan kaha hai prabhu ,Ek bar mere DAA ke teacher ko dikha aau sayad kuchh sikh le..

    • @amazepk
      @amazepk 5 лет назад

      @@abdul_bari jokes aside , thank you so much sir For putting Such an effort and making it free for us , saved my semester 🙏

  • @youssefelatmani5899
    @youssefelatmani5899 3 года назад +3

    Hi sir, I hope you're fine.
    I just have a question please;
    when you finish your calculation, you find that "K= log n #base 2#"
    But when you write the complexity of time, you just write "O(log n) #without a sign to the base#"
    Is that right? because it may refer to any "base",
    or maybe because adding the"base" to complexity does not change anything, or the change is not that important.
    I just want you, if you want please, to tell me the reason behind that.
    have a good day Mr. Abdul Bari

  • @tallalomar3531
    @tallalomar3531 5 лет назад +7

    Thanks Prof. you are doing awesome job, the way you explain the algorithms , may God bless you

  • @roohantariq706
    @roohantariq706 Год назад +1

    Sir agar meri koi behn hoti to mey apko deta shadi k liye

  • @asishraz6173
    @asishraz6173 4 года назад +4

    Wow, I loved the way I paused the video and did the substitution method and as well as tree method. Your way of teaching, making it easier and easier for all of us. Thank you so much, Sir.

  • @KhoiLe-gq5rd
    @KhoiLe-gq5rd 5 месяцев назад

    if the recurrence relation was instead T(n)=2T(n/2) +1, at the base step, would be equivalent to 2^k T(n/2^k) +k right? If so, would that simply into n(1) +logn making this big theta(n)?

  • @manaskundu5164
    @manaskundu5164 6 лет назад +4

    The way you explaining sir is just awesome..cleared all my doubts..Thank you very much sir.

  • @it_rajat_parate6667
    @it_rajat_parate6667 2 года назад +1

    hello sir u are my Idol ,
    we students will never gets an teacher like you .
    you are Gr8 sir , I am personally Very Big fan of u . if any Moment of life I want to meet you .
    I competed your DS course on Udemy on limited period of time & Begin with algorithm course .
    Sirr One and only last request from you if possible , plz make an DSA problems Sheet with link of your solving Ans & give Related Question As HomeWork .
    THen Onwards yours course is fully completed And we students Gets fully Prepared for Product Based Company.
    if the DSA sheet is created By [ Abdul Bari sir. ] , I Gaurented all your Lovingly Students gets Happy and Thankuable for ur Favour.
    Thank You Very Much Sir. 🤗

  • @vakhariyajay2224
    @vakhariyajay2224 2 года назад +2

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

  • @shaneyaw4542
    @shaneyaw4542 2 года назад +1

    The textbook I am reading skipped so much material that it is also impossible to figure out without a good explanation. This wa sexcellent.

  • @kavitajoshi6296
    @kavitajoshi6296 5 лет назад +3

    Thank you very much, sir, for such a simple straight explanation.
    I am getting problem while solving T(n)= T(n/4)+ C. The last step I obtained is 4C+T(n/2^8). how to solve next pl.guide.
    Pl. don't change the speed.this is required for other stream's students.

  • @smrutiranjandas5466
    @smrutiranjandas5466 6 лет назад +3

    Plz tell me what happen in case of T(n)=2T(n/2)+nlogn

  • @sevprogramming
    @sevprogramming 4 года назад +1

    explained it way better than sorry ass professors at UNT, thank you!

  • @sriyapatturi915
    @sriyapatturi915 2 года назад +1

    Thank you sir for helping me understand this difficult subject of Algorithms in a simpler, digestable way :)

  • @Dorianek8
    @Dorianek8 4 года назад +4

    7:10 isn't that "k" iteration?

  • @oTalDoAmaral_XD
    @oTalDoAmaral_XD 3 года назад +1

    I love your accent, kisses from Brazil!!

  • @ivandrofly
    @ivandrofly 4 месяца назад

    3:05 unity value for division and multiplication is 1

  • @ryanjohnson2844
    @ryanjohnson2844 7 месяцев назад

    thank u! I was forgetting to count my O(1) steps in the recurrence relation lol, I was like ain't no way this algorithms is O(1)

  • @forthecultstuff
    @forthecultstuff 3 года назад +1

    This is such an amazing simple explanation. Thankyouuu!! 😊😇

  • @atiquezaman8854
    @atiquezaman8854 2 года назад

    In the function, if we would take printf() 3 times, then would it be like T(n)=T(n/2)+1 T(n)=T(n/2)+3?? cause we are assuming the printf() line as 1.?

  • @Swansylinks
    @Swansylinks Месяц назад

    I am so so grateful for coming across your channel sir.. thank you so much for this comprehensive teaching ❤❤❤

  • @inewue1
    @inewue1 6 лет назад +3

    I LOVE YOU !!!

  • @urbanpendu3105
    @urbanpendu3105 6 лет назад +2

    @abdul bari ,U are doing a great job sir

  • @vishalrikhi4297
    @vishalrikhi4297 3 года назад +1

    EXCELLENT YAAR EXCELLENT ITS JUST WOW

  • @vinnudhanu8223
    @vinnudhanu8223 3 года назад

    Sir why can't n

  • @둘반둘반
    @둘반둘반 Год назад +1

    Thank you so much!

  • @muhammadsaqlainabbas4419
    @muhammadsaqlainabbas4419 4 года назад

    Sir, you mention in binary search algorithm time complexity same equation but there was your answer is that logn but here is log2n.Pls guide me

  • @chetankhanna8975
    @chetankhanna8975 5 лет назад +1

    Sir ..will we use big Oh notation in every question ? Plz answer quickly..

  • @AmitKumar-hh7de
    @AmitKumar-hh7de 2 года назад

    Thank you, sir, your videos are very helpful for me, I have seen many videos but now to see your videos my doubt is clear and understood the time complexity.

  • @jeetpatel5735
    @jeetpatel5735 5 лет назад +1

    Sir, @5:09 How many steps it is taking ? Shouldn't it be ( k+1 ) ?

  • @chuggachootales7131
    @chuggachootales7131 5 лет назад

    @Abdul Bari Sir how to solve T with two variables ? For example T(x, y) = Θ(x) + T(x, y/2) , T(x, c) = Θ(x) for c ≤ 2, T(c, y) = Θ(y) for c ≤ 2

  • @sudhakar7
    @sudhakar7 3 года назад +1

    Thank you sir !

  • @Adityasingh-nn5fe
    @Adityasingh-nn5fe 5 лет назад

    T(n)=2T(n/4)+3^1/2 sir i can't solve this question

  • @martinusyordansindhuatmaja8457
    @martinusyordansindhuatmaja8457 11 месяцев назад

    thankyou sir

  • @ΓιάννηςΙωαννίδης-π7ξ
    @ΓιάννηςΙωαννίδης-π7ξ 11 месяцев назад

    Eisai levetnis

  •  4 года назад +1

    ¡Gracias!

  • @devanshijoshi6338
    @devanshijoshi6338 6 лет назад +1

    Sir amazingly explained...... great job sir👍

  • @rushikeshthawale
    @rushikeshthawale 4 года назад +1

    Lots of Respect!

  • @radhikagummerla8514
    @radhikagummerla8514 6 лет назад +1

    Thank you sir for clearing my doubt

  • @JourneysAndInsight
    @JourneysAndInsight 2 года назад

    You are Pro now master theorem look obivious
    😍

  • @mohammedadel8948
    @mohammedadel8948 2 года назад

    Thank you , I appreciate your help so much

  • @mohamemdtalbi3679
    @mohamemdtalbi3679 3 года назад

    You are the best thank You for This super course

  • @SayanBanikAuthor
    @SayanBanikAuthor 6 месяцев назад

    5:32

  • @speak_charlie
    @speak_charlie 3 года назад +1

    IIIT dharwad pppl🙄 like karo

  • @LAG-24x7
    @LAG-24x7 6 лет назад +1

    so what is the answer if we put n/2^k =0

  • @shobhitsrivastava8876
    @shobhitsrivastava8876 3 года назад

    T(n) = T(n/2) + log(n). Can I have an explanation for this?

  • @smrutiranjandas5466
    @smrutiranjandas5466 6 лет назад

    Plzzz solve my pblm and show me

  • @josh-he3qg
    @josh-he3qg 2 года назад

    absolute unit !!!! thank you

  • @hadikleit8130
    @hadikleit8130 4 года назад

    Sir can I solve it by using master theorem ? Isn't it faster ?

  • @madhudwivedi3485
    @madhudwivedi3485 2 года назад

    Thanku so much sir

  • @chinmay52
    @chinmay52 6 лет назад +2

    Thank you for the video, I just have one question: if the function was returning Test(n/2)*Test(n/2), what would be the time complexity of that line?

    • @chinmay52
      @chinmay52 6 лет назад

      Abdul Bari thank you. Can I email you one question which is based on this?

    • @chinmay52
      @chinmay52 6 лет назад

      Thank you sir, didn't find your email so I have sent the problem on your Facebook page. Please check on Fb messenger.

  • @samiranroyy1700
    @samiranroyy1700 2 года назад

    Sir thank you

  • @SRNR_PODCAST.
    @SRNR_PODCAST. 3 года назад +1

    a gold mine in youtube

  • @nouf5184
    @nouf5184 2 года назад

    Thank You !

  • @yanbatista
    @yanbatista 2 года назад

    Thank you!

  • @siddhijoshi8759
    @siddhijoshi8759 4 года назад

    you are GOD !

  • @codetodecode299
    @codetodecode299 3 года назад

    nice

  • @speak_charlie
    @speak_charlie 3 года назад

    👍

  • @haribabumuddada3864
    @haribabumuddada3864 6 лет назад +1

    excellent sir my concepts are very clear thank u so much sir

  • @PankajKP
    @PankajKP 6 лет назад

    First Like and then Comment GOD and then watch!!

  • @monodeepbanerjee5427
    @monodeepbanerjee5427 4 года назад

    Time complexity of T(n) =2T(n)+n is 0(2^n) not 0(n2^n)as you have said

  • @naveenchandrakumar480
    @naveenchandrakumar480 5 лет назад

    Terrific Lectures and the Teacher

  • @shamparoy5394
    @shamparoy5394 5 лет назад

    Sir on starting of ur video the first questions sol is big oh(log n) but i have a doubt thay why big oh..why not omega because log n comes in lower bound as per previous videos.. Sir plzz do rply.. I got stucked here

    • @shamparoy5394
      @shamparoy5394 5 лет назад

      @@abdul_bari so here I can use omega also or only oh and theta

    • @shamparoy5394
      @shamparoy5394 5 лет назад

      @@abdul_bari thnku soo much sir ur videos r really very helpful