# 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))
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?
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'. 😎
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!
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 😂
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
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!
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.
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?
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...
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!
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!
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)
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.
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. (=
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.
# 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))
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?
@@ЙирюВонаирда i sure need em for tomorrows exam
Good to see so many people interested in me🥰🥰🥰
😂😂
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'. 😎
thanks for watching 😎
Learn python with Bro is as enjoyable as playing our favorite games
True
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!
Best example I have seen on explaining recursion
This taught me something about the stack and how code functions that I haven't learned from anywhere else, invaluable. Thank you! Blessings.
This is the best BEST explanation for recursion I’ve ever heard
Excellent explanation and examples!
I just wanted to thank you.
For teaching me programming and starting my coding career.
Tanks again.
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 😂
Subscribed and liked without even thinking twice
very impressive demonstration well done Sir
Cool way of understanding this, thank you.
Best channel for learning to program on RUclips. ❤
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
Thank You and Salute to @Bro Code‼️. I watched the entire 106 video playlist of Python.
Brilliantly demonstrated and explained. 🏆🏆🏆
Very well illustrated! Thanks
As always, you are the best, Bro 🤝🏻🤝🏻
really well explained, good stuff
This has showed me the important part for data analysis thanks bro 🙏
Great course, great instructor
Mah bro , Thanks a bunch ❤️💐
Great 👍
great video. thanks for uploading. and btw, first
It is seems very essy to learn with you thanks for making videos
excellent. well clarified 👏👏
Very interesting illustration
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
do you understand now?
Thanks Bro, that was a great explanation Bro
Sir your videos are very good thnx for uploading programming language tutorials for free.
Help a lot, thanks
Thanks bro❤️✨
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!
Thanks alot for this my Bro. You are a true BRO. ❤
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.
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?
Great tut, thanks!
you're doing gods work, bro
Great sharing
great as usual !! thanks
I am studying for finals right now and your videos are the best. You are so good at explaining. Thank you so much.
Thank you. No one told me that the best way to understand recursion is first understanding the stack
really helpful thanks bro
Finished in a less than a week, even though I work a full time job, very good course!
thanks allot for your help
thank you!
now recursion is a bit clearer to me :)
from this video i learn that programming is solving your own error code problem while trying to achieve your goal code
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...
I really enjoyed watching your videos but I think you should share your resources pls...!!
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
Hi Bro, thanks for all the work you've put into these tutorials.
1:47 no brackets to define scope of a function. Java for me.
Good job!!! 🤝
Keep up the excellent work
def add(*args):
total = 0
for arg in args:
total = total + arg
return total
print(add(1,2,3,4,5,6,7))
28
could you please make devops or aws videos please......!
I'm glad I found Bro Code, I'm still learning but Bro Code makes coding easy to learn.
I'm amazed how the recursive approach tends to be simpler to write. Thanks Bro Code!
✨✨
sick video dog. got 89% for my test just from this video
For 1 year later, learning 8 min tutorial decreased to 5 min. :D Thanks for the tutorial
cool video)
👍 Good
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!
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!
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.
You are a legend
Just when I thought I was out, they pulled me back in.
Thank you, Bro😎
Thank you!
You should add a positive only condition for the factorial in the recursice function :)
love it
nice
BROOO!! Finally I understand recursion 😂
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)
what is the sequence the code will go if there is more than one code calling back the function within the function?
Hello bro
what do you think about chat gpt?
will it replace devs?!
last video of the playlist
was it worth the watch?
Thank you
Thanks bro
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.
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. (=
random comment to help a fellow bro
Hey bro, I love your logo.
Sir you're can Please make video for django python course or playlist
Bruh I just saw that in class on week ago and didn’t understood shit. You are a wizard my guy.
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.
Thx
Why no more?
Bro is this a complete course of Python??
w vid
I’m the future, please do a series on rust
Hi sir, are you planning to make a tutorial for Lua language? thanks in advance
Hey Bro I really appreciate your work, right now I m struggling to import the java library JCap can you guide me trought it?
tysm!
sir bro code, do you have a tutorial were you use html, css and javascript altogether?
Why are numbers in the output of walk function reversed?
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
Who's watching dis in 2024,love all ur tutorials bro❤