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

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

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

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

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

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

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

  • @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.

  • @samadhanghorpade2302
    @samadhanghorpade2302 หลายเดือนก่อน +1

    01:06 Dividing functions call themselves for n by 2
    02:12 Recurrence relation T(n) = T(n/2) + 1 explained
    03:18 Recursion tree method for T(n)
    04:24 Reaching the base case of the recurrence relation T(n)=T(n/2)+1
    05:30 Algorithm time complexity is O(log n)
    06:36 Solving recurrence relation using substitution method
    07:42 Analyzing the recurrence relation T(n)
    08:41 Recurrence relation T(n) = T(n/2) + 1 results in Θ(log n)

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

    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.

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

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

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

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

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

    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

  • @tallalomar3531
    @tallalomar3531 6 ปีที่แล้ว +7

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

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

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

  • @almas.arcula
    @almas.arcula 3 ปีที่แล้ว +1

    I love your accent, kisses from Brazil!!

  • @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. 🤗

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

    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...

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

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

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

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

  • @AmitKumar-hh7de
    @AmitKumar-hh7de 3 ปีที่แล้ว

    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.

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

    @abdul bari ,U are doing a great job sir

  • @shaneyaw4542
    @shaneyaw4542 3 ปีที่แล้ว +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.

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

    You are Pro now master theorem look obivious
    😍

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

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

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

    EXCELLENT YAAR EXCELLENT ITS JUST WOW

  • @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.

  • @renasbaran9204
    @renasbaran9204 2 ปีที่แล้ว +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

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

    Lots of Respect!

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

    You are the best thank You for This super course

  • @youssefelatmani5899
    @youssefelatmani5899 4 ปีที่แล้ว +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

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

    Thank you!! God bless you.

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

    Hats of to you sir awesome explanation .

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

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

  • @sushantaray9116
    @sushantaray9116 7 ปีที่แล้ว +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

  • @KhoiLe-gq5rd
    @KhoiLe-gq5rd 8 หลายเดือนก่อน

    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)?

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

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

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

    3:05 unity value for division and multiplication is 1

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

    Thank you , I appreciate your help so much

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

    Thank you so much!

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

    Thank you sir for clearing my doubt

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

    I LOVE YOU !!!

  • @22P928BilalFarooqSiddiqui
    @22P928BilalFarooqSiddiqui 12 วันที่ผ่านมา

    sir while solving using the substitution method why we let k=log(n)?

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

    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)

  • @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

  • @josh-he3qg
    @josh-he3qg 3 ปีที่แล้ว

    absolute unit !!!! thank you

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

    thank you so much!!

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

    Thank you sir !

  • @某李-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

  • @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.?

  • @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)

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

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

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

    ¡Gracias!

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

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

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

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

  • @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.

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

    very well explained

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

    Very clearly explained sir

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

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

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

    Thanku so much sir

  • @shubham3079
    @shubham3079 5 ปีที่แล้ว +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)).

  • @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 :)

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

    Thank you!

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

    Terrific Lectures and the Teacher

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

    Sir why can't n

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

    Sir thank you

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

    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

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

    thankyou sir

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

    a gold mine in youtube

  • @sports-ft9se
    @sports-ft9se 5 ปีที่แล้ว

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

  • @ΓιάννηςΙωαννίδης-π7ξ
    @ΓιάννηςΙωαννίδης-π7ξ ปีที่แล้ว

    Eisai levetnis

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

    nice

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

    you are GOD !

  • @LAG-24x7
    @LAG-24x7 6 ปีที่แล้ว +1

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

    • @LAG-24x7
      @LAG-24x7 6 ปีที่แล้ว

      where T(n)=0

    • @LAG-24x7
      @LAG-24x7 6 ปีที่แล้ว

      ok thanks.

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

    How can I calculate Theta notation using this method.

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

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

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

    First Like and then Comment GOD and then watch!!

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

    👍

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

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

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

    5:32

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

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

  • @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 🙏

  • @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

  • @Adityasingh-nn5fe
    @Adityasingh-nn5fe 5 ปีที่แล้ว

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

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

    IIIT dharwad pppl🙄 like karo

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

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

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

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

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

    Plzzz solve my pblm and show me

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

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

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

    Thank You !