This is a Better Way to Understand Recursion

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • People often explain recursion in the form of an infinite loop. Recursion doesn't work that way; it is actually a lot like the movie Inception, and in this video, I will show you how!
    ☕️ I don’t accept paid sponsorships and I have turned off mid-video ads. You’re welcome! If you would like to support my channel see: ko-fi.com/alex...
    📨 Join my free weekly newsletter for advice, technology and more: newsletter.ale...
    🗺️ Backend Developer Roadmap: www.alexhyett....
    📝 Read me instead: www.alexhyett....
    🎓 RECOMMENDED COURSES (Use code FRIENDS10 for 10% off)
    The Complete Web Developer Course - academy.zeroto...
    The Complete Junior to Senior Web Developer Roadmap - academy.zeroto...
    Complete SQL + Databases Bootcamp - academy.zeroto...
    📚 RECOMMENDED BOOKS
    Clean Code - geni.us/5AEwj2
    Domain Driven Design - geni.us/WiR0Q0x
    Design Patterns - geni.us/5ncUt
    Developer Hegemony - geni.us/lAXy
    Pragmatic Programmer - geni.us/GfNj9
    Data Structures and Algorithms Made Easy - geni.us/sqg6kJ
    Refactoring - geni.us/ufAP0mE
    Pragmatic Thinking and Learning - geni.us/x81A
    Microservices - geni.us/8vMA
    🚀 MY FAVOURITE TOOLS
    PIA VPN - piavpn.com/Ale... (86% off)
    Visual Studio Code - code.visualstu...
    Obsidian - obsidian.md/
    Notion - affiliate.noti...
    You can check out more of my favourite tools on my website:
    www.alexhyett....
    🔗 MY KEY LINKS
    🌍 Blog - www.alexhyett....
    🐘 Mastodon - social.alexhye...
    🧑‍💻 WHO AM I
    I’m Alex, a Software Developer and TH-cam working in the UK. I make videos about software development to help developers with the skills they need to be senior developers. As well as this TH-cam Channel, I also write articles on my website (alexhyett.com) as well as write a regular newsletter that contains some thoughts to help aspiring developers.
    ‼️ DISCLAIMERS
    Some of the links in this description are affiliate links, for which I get a small commission, at no extra cost to you 🙂. I appreciate you supporting my channel so I can continue providing you with free software development content!
    Use of clips from Inception (2010) is under Fair Use:
    Copyright Disclaimer under section 107 of the Copyright Act 1976, allowance is made for “fair use” for purposes such as criticism, comment, news reporting, teaching, scholarship, education and research.
    #coding #programming #developer

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

  • @cruzchaps3662
    @cruzchaps3662 3 หลายเดือนก่อน +25

    Bro gave us the inception example and i thought he was going to explain it differently, then boom fibo is back

  • @ladro_magro5737
    @ladro_magro5737 3 หลายเดือนก่อน +25

    bro said ‘this is a better way to understand recursion’ and proceed not to explain anything useful

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

      The recursive joke here is that this is just like any other explanation of recursion

  • @ikroac
    @ikroac ปีที่แล้ว +77

    To understand recursion you need to understand recursion first 😮‍💨

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +19

      To understand recursion you need to understand recursion first 😮‍💨

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

      @@alexhyettdev To understand recursion you need to understand recursion first 😮‍💨

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

      @@douglasmasho2324 To understand recursion you need to understand recursion first 😮‍💨

    • @JoaoVictor-vd9fn
      @JoaoVictor-vd9fn 9 หลายเดือนก่อน

      @@garryanderson9831 To understand recursion you need to understand recursion first 😮‍💨

    • @aswina646
      @aswina646 5 หลายเดือนก่อน +6

      ​@@alexhyettdev To understand recursion you need to understand recursion first.

  • @turanbirligi6969
    @turanbirligi6969 20 วันที่ผ่านมา +5

    The problem is that, I cant think recursively when it gets too complex or too deep. I just lose the track or get overwhelmed. I have seen Factorial or Fibo example a dozen times but cant come up with a one all by myself.

  • @danieldyson2754
    @danieldyson2754 5 หลายเดือนก่อน +31

    In your next video, could you please explain recursion?

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

      In your next video, could you please explain recursion?

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

      @@sagarshah5341In your next video, could you please explain recursion?

    • @Shubham-fo7ug
      @Shubham-fo7ug 3 หลายเดือนก่อน

      ​@@marcusantenor793 In your next video, could you please explain recursion?

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

      @@Shubham-fo7ug if explanation is null return recursion explanation

  • @arpitkumar4525
    @arpitkumar4525 2 หลายเดือนก่อน +5

    You just told the surface level information/definition. I was hoping you would help develop an intuition for recursion

  • @theJYC
    @theJYC 8 หลายเดือนก่อน +17

    Wow, stumbled upon this video and floored by the quality of the explanation and inception analogy. Thank you so much!

    • @alexhyettdev
      @alexhyettdev  7 หลายเดือนก่อน +2

      Thank you! I am glad you liked it.

  • @freelance-writer
    @freelance-writer 28 วันที่ผ่านมา +1

    "Let me explain recursion by relating it to a notoriously convoluted movie." 😂

  • @sebwylleman
    @sebwylleman 11 หลายเดือนก่อน +8

    Great explanation and visuals Alex 🔥

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

      Thank you!

  • @weekendsonlyy3947
    @weekendsonlyy3947 7 หลายเดือนก่อน +3

    love the comparison to a movie, keep up the great videos!!

  • @kyomdonalddogo5775
    @kyomdonalddogo5775 6 หลายเดือนก่อน +2

    I dont understand recursion, esp how many times to call it or what operator to use it with. I honestly thank God for loops

  • @vinidevjiu
    @vinidevjiu 19 วันที่ผ่านมา

    the inception analogy was Brilliant!

  • @WiggyPineda-eg3gb
    @WiggyPineda-eg3gb 5 หลายเดือนก่อน +3

    thank you so much! I loved the analogy, it really helped and now I must go watch inception again. Ive had a hard time wrapping my head aroound python, I mean I ace my classes so that must mean I understand it right? it just feels like Im not getting it.

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

    Why did the programmer get stuck in a recursive loop?
    Because he wanted to see how deep the rabbit hole went, but he forgot to include a base case in his recursive function. So he just kept calling the function over and over again, each time passing in the same parameters, until his stack overflowed and his program crashed.
    But don't worry, he learned his lesson. From then on, he always made sure to include a base case in his recursive functions, and he never got stuck in an infinite loop again... at least, not until he started playing with pointers and accidentally created a memory leak.
    Ah, programming. The gift that keeps on giving, even when you wish it would just stop already.

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

      Loved this! There is always something to trip us up. My favourite one is debugging race conditions. They are impossible to replicate if you are stepping through code.

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

    Can't believed I watched 10 minutes plus of videos trying to understand this only to get it on a 4 minutes 3 seconds video😂.

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

    Bro stop with the fibonnaci example, its too easy. It wont help me understand how to get the height of a node in a tree. Surprisingly i can code it but i dont understand it.

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

    thanks for the explanation 🙂

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

    Im learning for some time coding, but recoursion is one of those things that Im very bad at. If you dont need to nest it in the loop its not that hard. But one you need to use it in like 2-3 loops it gets hard.

  • @kevint3522
    @kevint3522 6 หลายเดือนก่อน +2

    Very good quality video. It's too high level for my needs though. I need to understand what's happening on the stack and with the stack frames. Do you do anything with combinatorics? Like how to use recursion to find unique combinations of k integers from a list of n integers? I ChatGBT'd it and walked through the solution. The solution wraps a recursive call into a for loop. I can almost trace it, but it is very difficult to understand. I get the impression this is a well-known problem, but I had no prayer of solving it myself because I don't know how to think through it.

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

      If you want a proper answer, the first step is to stay away from webdev channels.

    • @Nicholas.pl_
      @Nicholas.pl_ 2 หลายเดือนก่อน

      same bro

  • @theredtree7493
    @theredtree7493 19 วันที่ผ่านมา

    This is a Better Way to Understand Recursion

  • @Faizi007-bk9om
    @Faizi007-bk9om หลายเดือนก่อน

    tomorrow i have an exam n the question will be like they will give me last part of the recursive r any code n want me to write the recursive form of it yet i couldnt get my answer that how to know to write that.
    if u or anybody know the proceture i will be grateful if u guys tell me.

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

    "Don't worry, I won't spoil the movie Inception for you"
    Proceeds to spoil it for me💔

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

      It doesn’t spoil anything beyond what you learn in the first 10 minutes of the film. I watched it again last night. Great film even though it is 13 years old already!

  • @josephalbert.
    @josephalbert. 6 หลายเดือนก่อน +2

    did you mean recursion? (this was really funny haha)

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

    thanks very much simple to understand
    can you explain to us what is BacktrackingFile please

  • @blazingguyop
    @blazingguyop 7 หลายเดือนก่อน +2

    The best video on recursion
    What an example 🙏
    Was stuck at why it return back (kick) later understood just thinking logically 😂
    Now everything clear 😅👌
    Btw now I get it why people call some youtubers underrated😢

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

    recursion

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

    Great video!

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

    stack overfflew

  • @UnknownGamer-lw7zp
    @UnknownGamer-lw7zp หลายเดือนก่อน

    🔁

  • @user-hq5en9qp5u
    @user-hq5en9qp5u 5 หลายเดือนก่อน

    did you mean recurions

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

    Recursion

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

    Nice work! Adding memoization would mitigate some of the inefficiencies you mentioned.

  • @michaelbtw
    @michaelbtw 5 หลายเดือนก่อน +2

    I know you want to be fast for youtube because it's cool and edgy, but if you want people to learn from your videos, pause when you show code or equations and leave them onscreen for a few seconds so people can see what you are talking about - the human brain doesn't do well trying to read and listen at the same time.

    • @alexhyettdev
      @alexhyettdev  5 หลายเดือนก่อน +2

      I have tried slowing it down a bit in newer videos. It's not really about being cool and edgy (I am too old for that), I just speak faster when nervous. I am still not that comfortable talking to a camera!

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

    char* understandRecursion(){
    int understood = 0;
    If(understood)
    return "finally";
    else
    return understandRecursion;
    }

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

      Notice that understood never becomes 1

  • @d-19jyotishchandrak70
    @d-19jyotishchandrak70 5 วันที่ผ่านมา

    recursion is like:

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

    Now do corecursion 😂

  • @DeepakKumar-ob6ps
    @DeepakKumar-ob6ps 18 วันที่ผ่านมา

    What was this? And why did TH-cam put it on top in my search? BS

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

    th-cam.com/video/Q83nN97LVOU/w-d-xo.htmlsi=nmNVMsu6AHailDE_

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

    That

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

      actually

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

      makes

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

      sense!

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

      And

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

      It

  • @reginald9125
    @reginald9125 15 วันที่ผ่านมา

    This is a BAD explanation..

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

    thanks for teaching. NOTHING. so i learned.....NOTHING. !! what a JOKE. !!

    • @alexhyettdev
      @alexhyettdev  10 หลายเดือนก่อน +4

      Why watch a video on recursion if you already understand it?

    • @whitehh15
      @whitehh15 8 หลายเดือนก่อน +5

      With a comment that dumb; it's safe to assume you're not going to understand recursion no matter how it is taught.

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

    Fuxk this recursion i leave programming because for this recursion. Now im doing mba 😅

    • @alexhyettdev
      @alexhyettdev  11 หลายเดือนก่อน +2

      To be fair there are only a handful of times that I have put recursion to good use. You could always go back to programming once you have your MBA and start SaaS company!

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

    Great video!!!

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

      Great video!!

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

      Great video!

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

    Recursion

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

    recursion