Learn RECURSION in 5 minutes! 😵

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

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

  • @BroCodez
    @BroCodez  2 года назад +78

    # recursion = a function that calls itself from within
    # helps to visualize a complex problem into basic steps
    # problems can be solved more easily iteratively or recursively
    # iterative = faster, complex
    # recursive = slower, simpler
    # ----- EXAMPLE 1 -----
    # ITERATIVE
    def walk(steps):
    for step in range(1, steps+1):
    print(f"You take step #{step}")
    # RECURSIVE
    def walk(steps):
    if steps == 0:
    return
    walk(steps - 1)
    print(f"You take step #{steps}")
    walk(100)
    # ----- EXAMPLE 2 -----
    # ITERATIVE
    def factorial(x):
    result = 1
    if x > 0:
    for i in range(1, x + 1):
    result *= i
    return result
    # RECURSIVE
    def factorial(x):
    if x == 1:
    return 1
    else:
    return x * factorial(x - 1)
    print(factorial(10))

    • @ЙирюВонаирда
      @ЙирюВонаирда 2 года назад +1

      does it even make sense? I mean... why choose recursive way to solve a matter? Is there any advantages outside of simplification? Mb memory consumption or speed? Why use it if u dont mind complex code? Any example where recursion gave a more suited solution than iterative way?

    • @captainhostile101
      @captainhostile101 Год назад

      @@ЙирюВонаирда i sure need em for tomorrows exam

  • @recursion.
    @recursion. Месяц назад +13

    Good to see so many people interested in me🥰🥰🥰

  • @OceanLover8008
    @OceanLover8008 2 года назад +126

    Thanks bro for always uploading extremely useful content for free.
    I'm a student right now and I really appreciate all the efforts that you are taking. ❤️
    Proud to be a 'Bro'. 😎

    • @BroCodez
      @BroCodez  2 года назад +22

      thanks for watching 😎

  • @zabehullahalizadeh2310
    @zabehullahalizadeh2310 2 года назад +120

    Learn python with Bro is as enjoyable as playing our favorite games

  • @itayzabar2953
    @itayzabar2953 2 года назад +37

    Hi Bro Code!
    I'm studying computer science in highschool rn and after two month learning how to use recursion i am still struggling.
    I think that your video on it might gave me some crucial insights about the topic and the usage of it.
    Thank you so much❤️
    I rly like your videos so keep creating great content!!
    Have a great day!

  • @Loco4Waffles
    @Loco4Waffles 9 месяцев назад +1

    Best example I have seen on explaining recursion

  • @randymartin9040
    @randymartin9040 3 месяца назад +3

    This taught me something about the stack and how code functions that I haven't learned from anywhere else, invaluable. Thank you! Blessings.

  • @salihmorta4172
    @salihmorta4172 11 месяцев назад +1

    This is the best BEST explanation for recursion I’ve ever heard

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

    Excellent explanation and examples!

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

    I just wanted to thank you.
    For teaching me programming and starting my coding career.
    Tanks again.

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

    Bro is the g. Ty my friend. When other RUclipsrs fail to deliver an answer that is simple and easy to understand, you come in and kill it. ❤
    I was stuck on this for an hour before trying this video. But man I wish I knew this a month ago 😂

  • @Daniyar-AbuUmar
    @Daniyar-AbuUmar Год назад

    Subscribed and liked without even thinking twice

  • @shoukatiqbal5674
    @shoukatiqbal5674 2 месяца назад

    very impressive demonstration well done Sir

  • @randymartin9040
    @randymartin9040 3 месяца назад

    Cool way of understanding this, thank you.

  • @anshhmalviyaa
    @anshhmalviyaa Год назад

    Best channel for learning to program on RUclips. ❤

  • @t2trix1
    @t2trix1 21 день назад

    This is the first time I've kind of understood recursion, the minecraft visual and the code comparison to the loop in this video specically is great

  • @OllyCybSec
    @OllyCybSec 8 месяцев назад +1

    Thank You and Salute to @Bro Code‼️. I watched the entire 106 video playlist of Python.
    Brilliantly demonstrated and explained. 🏆🏆🏆

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

    Very well illustrated! Thanks

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

    As always, you are the best, Bro 🤝🏻🤝🏻

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

    really well explained, good stuff

  • @bryce3851
    @bryce3851 8 месяцев назад

    This has showed me the important part for data analysis thanks bro 🙏

  • @audiemolinger6450
    @audiemolinger6450 8 месяцев назад

    Great course, great instructor

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

    Mah bro , Thanks a bunch ❤️💐

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

    Great 👍

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

    great video. thanks for uploading. and btw, first

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

    It is seems very essy to learn with you thanks for making videos

  • @kadirv
    @kadirv 10 месяцев назад

    excellent. well clarified 👏👏

  • @eddisonlewis8099
    @eddisonlewis8099 Год назад

    Very interesting illustration

  • @QhY-j2e
    @QhY-j2e 5 месяцев назад +2

    Hi bro, may i ask the logic behind how at 2:28 changing the print function to below walk (steps -1) makes the counter go forward?
    i cant seem to wrap my head around it

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

    Thanks Bro, that was a great explanation Bro

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

    Sir your videos are very good thnx for uploading programming language tutorials for free.

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

    Help a lot, thanks

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

    Thanks bro❤️✨

  • @julia-kc3kp
    @julia-kc3kp Год назад

    hey! just realized i'm your 850,000st subscriber 🥳 love this channel, you are doing something very valuable and precious here. thank you for being an absolute bro!

  • @Nishitha_Jay
    @Nishitha_Jay 9 месяцев назад

    Thanks alot for this my Bro. You are a true BRO. ❤

  • @MalaPalabra-zr6wg
    @MalaPalabra-zr6wg Год назад

    I'm a student of Telecommunications engineering, and I made Calculus Lambda with Haskell to improve my programmation abilities. And thanks to that elective I learnt how to use recursive.

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

    Hi Code Bro from what I can see, you are the most thorough and clear person teaching coding on RUclips. Whatever your teaching style it matches my learning style. Is there any chance that you can do a full course on React?

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

    Great tut, thanks!

  • @arsacode6145
    @arsacode6145 Год назад

    you're doing gods work, bro

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

    Great sharing

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

    great as usual !! thanks

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

    I am studying for finals right now and your videos are the best. You are so good at explaining. Thank you so much.

  • @ZyrusAlvez
    @ZyrusAlvez 10 месяцев назад

    Thank you. No one told me that the best way to understand recursion is first understanding the stack

  • @杨玄-v4k
    @杨玄-v4k 11 месяцев назад

    really helpful thanks bro

  • @kristijanlazarev
    @kristijanlazarev 10 месяцев назад

    Finished in a less than a week, even though I work a full time job, very good course!

  • @Geniuspaul-Projects
    @Geniuspaul-Projects 2 года назад

    thanks allot for your help

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

    thank you!
    now recursion is a bit clearer to me :)

  • @tictactechin
    @tictactechin Год назад

    from this video i learn that programming is solving your own error code problem while trying to achieve your goal code

  • @OBGCORP
    @OBGCORP Год назад +4

    Hey man, love your videos! Watched all the playlist to have a clear understanding when I get asked an algorithm question in an interview. However, I am struggling to find all the permutations of a given string and return the permutations in an array. Could you please make a video about it where you explain the recursion we use there in depth? (in Java please) Thank you...

  • @Simonjoel-469
    @Simonjoel-469 6 месяцев назад +1

    I really enjoyed watching your videos but I think you should share your resources pls...!!

  • @sinankodur4251
    @sinankodur4251 Год назад

    Bro you are the best
    I am without words bro, your examples are perfect
    Anyone can learn coding with this
    Great work and big fan of you

  • @Vue-daigle
    @Vue-daigle Год назад

    Hi Bro, thanks for all the work you've put into these tutorials.

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

    1:47 no brackets to define scope of a function. Java for me.

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

    Good job!!! 🤝

  • @codecaine
    @codecaine Год назад

    Keep up the excellent work

  • @abdulhannan-18
    @abdulhannan-18 Год назад +1

    def add(*args):
    total = 0
    for arg in args:
    total = total + arg
    return total
    print(add(1,2,3,4,5,6,7))
    28

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

    could you please make devops or aws videos please......!

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

    I'm glad I found Bro Code, I'm still learning but Bro Code makes coding easy to learn.

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

    I'm amazed how the recursive approach tends to be simpler to write. Thanks Bro Code!

  • @poi9696
    @poi9696 3 месяца назад +1

    ✨✨

  • @AbelBen-fz6hs
    @AbelBen-fz6hs 8 месяцев назад

    sick video dog. got 89% for my test just from this video

  • @TheKr0ckeR
    @TheKr0ckeR 9 месяцев назад

    For 1 year later, learning 8 min tutorial decreased to 5 min. :D Thanks for the tutorial

  • @MarcosBilly-x7y
    @MarcosBilly-x7y Год назад

    cool video)

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

    👍 Good

  • @RexMan04
    @RexMan04 Год назад

    Got my comp sci final in 1 hour and couldn't for the life of me figure out recursion before this (its 40% of my final). I think I understand it better now, and this should help me a lot!

  • @Jess-xg7ok
    @Jess-xg7ok Год назад +1

    I like the style of your video and the examples and the sample code. I am wondering if you can do the tutorial on Python Panda, NumPy, and others that are more commonly used in data analysis/data science? Thanks!

  • @keldur16
    @keldur16 Год назад

    I understand what recursion is. I am struggling to understand why I would use it
    Love your videos tho. You’re always a major help.

  • @GhostGaming-tt9tu
    @GhostGaming-tt9tu Месяц назад

    You are a legend

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

    Just when I thought I was out, they pulled me back in.

  • @nik4465
    @nik4465 Год назад

    Thank you, Bro😎

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

    Thank you!

  • @sirwinkiebinkie8270
    @sirwinkiebinkie8270 Год назад

    You should add a positive only condition for the factorial in the recursice function :)

  • @tigerli2262
    @tigerli2262 9 месяцев назад

    love it

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

    nice

  • @Chocolatey24
    @Chocolatey24 10 месяцев назад

    BROOO!! Finally I understand recursion 😂

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

    An easier approach to understand and solve finding the factorial of a number using recursion
    number, result = int(input("Enter Any Number")), 1 # both of these are global variables
    def fact(num):
    global result # to access and modify value of a global variable in python
    if num == 1:
    return
    result *= num # we need to use global keyword and here we are telling the function to change
    # the value of result globally
    fact(num - 1)
    fact(number)

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

    what is the sequence the code will go if there is more than one code calling back the function within the function?

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

    Hello bro
    what do you think about chat gpt?
    will it replace devs?!

  • @ohChardy
    @ohChardy 7 месяцев назад +1

    last video of the playlist

  • @realitybeckons4120
    @realitybeckons4120 Год назад

    Thank you

  • @AlexTerrable
    @AlexTerrable Год назад

    Thanks bro

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

    Hey bro, was wondering if you could show us how to make our own JDK? That way one can conveniently use heaps of code without having to actually add libraries and modules when starting a fresh project. So we wouldn't be replacing JDK 19 but just adding our JDK to the IDE with our few packages we have in there to use.

  • @Vue-daigle
    @Vue-daigle Год назад +1

    Thks Bro, great Python videos simply explaining all these features of the language ... 😎 Would you consider moving on to commonly used frameworks like Flask + Strapi ? They seem to be complementary and powerfull for Web dev. (=

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

    random comment to help a fellow bro

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

    Hey bro, I love your logo.

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

    Sir you're can Please make video for django python course or playlist

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

    Bruh I just saw that in class on week ago and didn’t understood shit. You are a wizard my guy.

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

    nice one can you please also mention link to the complete playlist to which this video belongs its hard to find the playlist where I can check out other videos. I will add one like for the youtube prayer algo now thanks.

  • @tilkesh
    @tilkesh Год назад

    Thx

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

    Why no more?

  • @hadiashahid4679
    @hadiashahid4679 Год назад

    Bro is this a complete course of Python??

  • @BlahblAHbLaH-1_
    @BlahblAHbLaH-1_ Год назад

    w vid

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

    I’m the future, please do a series on rust

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

    Hi sir, are you planning to make a tutorial for Lua language? thanks in advance

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

    Hey Bro I really appreciate your work, right now I m struggling to import the java library JCap can you guide me trought it?

  • @ameyagupta7285
    @ameyagupta7285 Год назад

    tysm!

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

    sir bro code, do you have a tutorial were you use html, css and javascript altogether?

  • @maxim1308
    @maxim1308 Год назад

    Why are numbers in the output of walk function reversed?

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

    Can you make video on GUI Grx in C, iam so lost and i really want to learn it to get good grades,thank you so much for what you are doing

  • @BüblySnowfláke-m3x
    @BüblySnowfláke-m3x 7 месяцев назад

    Who's watching dis in 2024,love all ur tutorials bro❤