🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Programming Concepts Intermediate

What is Recursion?

A programming technique where a function calls itself to solve a problem by breaking it into smaller subproblems.

Recursion solves problems by having a function call itself with modified parameters until reaching a base case. Classic examples include factorial calculation, Fibonacci numbers, tree traversal, and divide-and-conquer algorithms.

Every recursive solution needs a base case (stopping condition) to prevent infinite recursion. Tail recursion can be optimized by compilers. Some problems are naturally recursive (tree/graph traversal), while iterative solutions may be more efficient for others.

Related Terms

Garbage Collection
An automatic memory management process that identifies and reclaims memory no longer in use by a program.
Stack
A data structure that follows Last-In-First-Out (LIFO) ordering, where elements are added and removed from the same end (top).
Queue
A data structure that follows First-In-First-Out (FIFO) ordering, where elements are added at the rear and removed from the front.
Hash Table
A data structure that maps keys to values using a hash function, providing average O(1) time complexity for lookups, insertions, and deletions.
Unit Testing
Testing individual components or functions of a program in isolation to verify they work correctly.
Clean Code
Code that is easy to read, understand, and maintain — following consistent conventions, meaningful naming, and single-responsibility functions.
View All Programming Concepts Terms →