Fibonacci Sequence - Anatomy of recursion and space complexity analysis

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025

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

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

    I must say that this was the height of brilliance in teaching the basics of how space is utilized when a function is called. I was overwhelmed by the way you explained it. This cleared a lot of fog off my road. This was truly the anatomy of recursion. Thank you @mycodeschool if you're reading this.😍

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

    When it comes to "My code school", it never disappoints me.

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

    One of the best explanations of function call stack utilization I have ever seen! Thank you :-)

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

    11 years later and this video still has tremendous value, thank you for clearing the clouds...

  • @SmartProgramming
    @SmartProgramming 6 ปีที่แล้ว +12

    wow deeply explained , you are doing a great job sir, stay blessed 👍👍🙂

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

    Awesome explanation. I find it very interesting that the resulting 'tree' from the recursion visually shows how it branches off into the parts of the summation, which then appear on the left-most (max depth level) branch as the Fibonacci sequence.

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

    legends view this vedio one hour before the exam

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

    I looked for many videos , this one is the one that helped me, thanks

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

    Thank you so much. A lot of youtube videos have the space complexity analysis of the fibonacci sequence wrong. This helped me understand recursion a lot more.

  • @sunnyjain630
    @sunnyjain630 7 ปีที่แล้ว +8

    please add more videos on Dynammic Programming....!most appreciated!!

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

    I am watching it in 2021 , u know it still worth it , thank you profoundly

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

    Que buena explicación, justo lo que estNa buscando. Thank you so much!!! 😊

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

      Hi! How are you

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

    This was fantastic. Thank you. It's a lot more clear to me now

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

    Best Explanation of function call stack I have ever seen. Thank You

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

    Thank you! It's so lucidly explained and now I finally could understand what's going on during debugging.

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

    Ur video made my day 🙂.Tq ❤️

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

    great explanation sirji, i am highly thankful to u.

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

    Please add the videos for Algorithms same as you did for Data Structure.

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

      sadly he is no more. he expired in an accident

    • @AMITSHARMA-oh1nq
      @AMITSHARMA-oh1nq 5 ปีที่แล้ว +1

      @@last_theorem really!!!

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

      @@AMITSHARMA-oh1nq yea bro. Just Google about it, there is a full article about it in his facebook page as well. Posted by some of his friend. I felt really bad when i got knw about it through a friend . He is really an inspiration the legacy he left is fab.

  • @m.imranzaheer1368
    @m.imranzaheer1368 2 ปีที่แล้ว

    Nice explanation 👍

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

    Very good explanation. Thank you

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

    Incredibly clear and helpful thank you so much

  • @Alan-qb9qt
    @Alan-qb9qt 5 ปีที่แล้ว +2

    Marvelous tutorial

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

    Your explanations are fantastic!! Thank you very much!!!

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

    The best explaination Thanks sir😍

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

    great explanation, the recursion tree illustration is very intuitive...can you give some recursion tutorial video on combination, permutation and graph traversal? I believe your graph traversal recursive algorithm video would be an excellent compliment to your graph data structure video...cheers

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

    4:46 no but F(5) calls F(4) and F(3) at the same time now? Why the one sided analysis first?

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

    excellent brother.

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

    Thank you so much, Sir, I understood recursion, function call stack, and all properly, thanks a lot

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

    Awesome video!

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

    Very clear and understandable, Thank you!

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

    My God! This is brilliant!

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

    Excellent, thank you very much!

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

    Shouldn't it be F(5) calls F(4) + F(3) and F(4) calls F(3) + F(2) so the implicit stack goes like F(5),F(4),F(3),F(4), F(3),F(2) and so on ?

    • @simratchehal6442
      @simratchehal6442 8 ปีที่แล้ว +9

      No. since F(5) is calling F(4) first so as soon as we reach F(4), it will leave the function and start making a call to F(4) and then F(4) requires F(3), F(3) requires F(2), F(2) requires F(1), and as soon as it gives F(1) its value i.e. 1 , it will travel in reverse and now since we know F(1) , it will go back to the function where we were finding F(2) which after F(1) now require F(0) i.e. 0 , F(2) would be returned to the function where its call was made. And this goes on.
      We basically don't keep the called functions on hold so as soon as some function is called, the code would only reverse its direction once it has got the value .

    • @velevki
      @velevki 8 ปีที่แล้ว

      Simrat Chehal Thanks for the explanation.

    • @pallasuryakumar6931
      @pallasuryakumar6931 7 ปีที่แล้ว

      good explanation.
      I understood till reaching the f(1) and as value is available for f(1) ,it is traversing back to f(2) .But I can't understand how it is taking f(0) and where it is storing f(0) and similarly the right side functions of + sign when traversing up.
      Please do reply.

  • @JayaprasadB-px4vc
    @JayaprasadB-px4vc ปีที่แล้ว

    Fibnoacci series recursive call space complexity is : O(n)
    Time complexity is : O(2^n)

  • @crummmycheese
    @crummmycheese 11 ปีที่แล้ว

    nice way ,this explanation fitted my head

  • @ShibaCat
    @ShibaCat 7 ปีที่แล้ว

    I have a great learning by your video! and how about time complexity? any tutorial?

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

    thanks brother

  • @Pratikpv
    @Pratikpv 11 ปีที่แล้ว

    very nice explanation.. Thanks

  • @Maheeky
    @Maheeky 8 ปีที่แล้ว

    Awesome video, thank you

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

    this is what i want from the youtube

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

    Sooo..... helpful👌

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

    Why does F(2) make a call to F(0) instead of F(1)?

  • @SadarHussain-m7w
    @SadarHussain-m7w 2 หลายเดือนก่อน

    very good

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

    well explained

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

    after popping 0 and 1 , why does F(2) when called for second time add 0 and 1 , why can't it make a call for f(0) again?

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

    thank you sir

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

    thank you

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

    where did fib
    (5) come from??

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

    v goood explanation. regards

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

    #1 teacher

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

    so the more functions are called that create more data in mass over time would be that of a larger space complexity.
    Even if the time complexity of the code is something of O(1) this is still a phattness problem.
    Because the expansion of this kind of data creates more problems if not dealt with?
    Am I interpreting this correctly?

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

    thank u sir

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

    Hats off for the way of explaining, but if anyone can help i have a question :-
    when, f(4) = f(3) + f(2)
    then it did got it from f(3) value from stack memory but f(2) already poped out then how did it got value of f(2)
    Did it received through f(3) ? is it possible that f(3) carries the value of f(2) which is already popped out?
    thank you help would be great!

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

      F(3), would make another call to f(2), and subsequently to f(1). The f(2) will make its own f(1) and f(0) calls.

  • @kentmillamena1518
    @kentmillamena1518 9 ปีที่แล้ว

    what if the tree calls(2,6). How would we work this out?

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

    Can u plz explain Fibonacci Search ...plz

  • @musabr.5685
    @musabr.5685 6 ปีที่แล้ว

    Thanks man...!

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

    we tend to call the pre calculated functions a lot like f2 or f3 f1 is there a way to store the state maybe like a dictionary so that everytime we call it if it's present in the dic we can just return the pre computed value ? can we do that ?

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

    I have a doubt. Could you please tell me how F(2) calls F(0) ?

  • @marktonight902
    @marktonight902 10 ปีที่แล้ว

    I see the sequence as reflective knowing

  • @sumitkumar-in2si
    @sumitkumar-in2si 4 ปีที่แล้ว

    अच्छा एक्सप्लेन किया आपने ।

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

    gr8 vedio!!!

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

    what about time complexity? :)

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

    the 5th fibonacci number is 3 not 5.

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

    legend

  • @ChandraSekhar-tr7sf
    @ChandraSekhar-tr7sf 3 ปีที่แล้ว

    expecting python tutorials from u

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

      Lmao this was 8 years ago and the founder is working in Google full-time after the co-founder died. 😭 So we can't expect anymore from him. It was a nice journey with the two legends

  • @hirakmondal6174
    @hirakmondal6174 7 ปีที่แล้ว

    plssss improve the sound quality... btw the video has helped me a lot... :)

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

    Time complexity is wrong, it is exponential.

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

    Your series start from 1 but fibonacci should start from 0.

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

      although it doesn't matters whether you start from one or zero. But since the origin of the sequence was inspired from rabbit population for which u need one male and one female so sequence start from 1 and 1

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

    It's good but shouldn't fib(5) eventually return n which value is 6 for 5 is 6th term in a Fibonacci series?

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

    Excellent explanation.Thanks a million.