Skip to content
0:00 / 0:00

#recursion#callstack#factorial

What on Earth is Recursion? - Computerphile

Computerphile

2.6M subscribers • 66 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by David Brailsford, professor at the University of Nottingham

Beginner. No background in the topic needed.

780K views12 years ago2 recommendations

Computer scienceAlgorithmsFunctional programming

Professor David Brailsford explains the concept of recursion and how the call stack manages multiple scopes.

Audible Free Book: audible.com/computerphile Recursion; like something from the film "Inception". Even Professor Brailsford says it can be hard to get your head around - watch him make it much easier to understand... EXTRA BITS: youtu.be/0pncNKHj-Sc Opening up the Original Mac: youtu.be/wFJrHuSXnZM facebook.com/computerphile twitter.com/computer_phile This video was filmed and edited by Sean Riley. Computer Science at the University of Nottingham: bit.ly/nottscomputer Computerphile is a sister project to Brady Haran's Numberphile. See the full list of Brady's video projects at: bit.ly/bradychannels

Why it's here

2 people recommend this

What people say. Recommended as an excellent, easy-to-understand explanation of recursion and call stacks.

u/a4qbfbin r/C_Programming • Recommends

On “Help me guys please!”

> I still "see" the recursive function in line 23 just like a division by 2. Which obviously is not. Think of it as: “when I get to this point, I make a note of what I was doing, then evaluate `toBinary()` with half the original number as argument; once that is done, I insert that into my arithmetic expression and continue.” > I also don't get why in your example you basically never enter the base case of the function that should terminate it. Because we had already examined that case, so I just reused the previous result instead of going through it again. I have an idea. Take that code and type it in, if you haven't already. Then replace the last line of `toBinary()` with the following:…

u/mojodojo7in r/compsci • Recommends

On “Recursion”

This is a great 9 min video from computerphile that really helped me learn what recursion is. He uses the example of n! to illustrate his point. The best thing that this video taught me was that "there's not one n, but many." By this, he means that there every time the function calls itself, there is another scope set up in the call stack. Once you hit your base case, the result of the inner function is passed to the outer function all the way up the chain until the final n is returned. [video