filmov
tv
What is a RECURSIVE function in Python? | Calculate a factorial operation recursively

Показать описание
LINKS TO FULL CONTENT
FULL LESSON DESCRIPTION
Recursion is a method of solving a problem where its solution depends on solutions to smaller instances of the same problem. In Python we can write our own recursive functions, characterized by the fact that they invoke themselves within their own code. In this lesson, I’ll introduce this interesting idea bit by bit, by revisiting a familiar numeric algorithm —the calculation of the factorial of a number—, and I’ll show a detailed analysis of a recursive function that solves it.
FULL LESSON CONTENT
Part 1. Recursive factorial calculation
Part 2. Trace of the factorial program
Part 3. Call trees
Part 4. Stack overflow
FULL LESSON DESCRIPTION
Recursion is a method of solving a problem where its solution depends on solutions to smaller instances of the same problem. In Python we can write our own recursive functions, characterized by the fact that they invoke themselves within their own code. In this lesson, I’ll introduce this interesting idea bit by bit, by revisiting a familiar numeric algorithm —the calculation of the factorial of a number—, and I’ll show a detailed analysis of a recursive function that solves it.
FULL LESSON CONTENT
Part 1. Recursive factorial calculation
Part 2. Trace of the factorial program
Part 3. Call trees
Part 4. Stack overflow