Recursion Explained: The Function That Calls Itself
The Logic Layer
0:00 / 0:00
Recursion Explained: The Function That Calls Itself
186 просмотров · 4 дн. назад
The Logic Layer
239 подписчиков
186 просмотров · 4 дн. назад
What if, to solve a problem, a function simply called itself? It sounds like it should loop forever, yet recursion powers folder searches, sorting algorithms, puzzles, and even shows up in nature.
In this video we build recursion from the ground up: Russian nesting dolls, the two rules every recursive solution needs (base case + recursive step), factorial step by step, what really happens inside the call stack, the two classic traps (stack overflow and slow Fibonacci, fixed with memoization), and where recursion hides in the real world: folders, merge sort, the Tower of Hanoi and fractals.
⏱️ Chapters
0:00 The function that calls itself
1:27 Russian dolls
2:58 The two rules
4:24 Factorial, step by step
6:10 The call stack
7:58 When it goes wrong
9:50 Recursion in the real world
11:34 Thinking recursively
If recursion finally clicked for you, subscribe to The Logic Layer for more visual explainers on math, AI and computers.
#Recursion #Programming #ComputerScience #Coding #Algorithms #LearnToCode #TheLogicLayer