A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/recursion-algorithms/ below:

Recursive Algorithms - GeeksforGeeks

Recursive Algorithms

Last Updated : 23 Jul, 2025

Recursion is technique used in computer science to solve big problems by breaking them into smaller, similar problems. The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. Using a recursive algorithm, certain problems can be solved quite easily.

Basics In Different Languages Easy Problems Medium Problems Hard Problems Practice Sets on Recursion

Quiz based on Recursion:

What is a Recursive Algorithm?

A recursive algorithm is an algorithm that uses recursion to solve a problem. Recursive algorithms typically have two parts:

  1. Base case: Which is a condition that stops the recursion.
  2. Recursive case: Which is a call to the function itself with a smaller version of the problem.
Types of Recursion

There are several different recursion types and terms. These include:

When to Use Recursion?

Recursion is a powerful technique that can be used to solve a wide variety of problems. However, it is important to use recursion carefully, as it can lead to stack overflows if not used properly.

Recursion should be used when:

Examples of Recursion

Here are some common examples of recursion:

Example 1: Factorial: The factorial of a number n is the product of all the integers from 1 to n. The factorial of n can be defined recursively as:

factorial(n) = n * factorial(n-1)

Example 2: Fibonacci sequence: The Fibonacci sequence is a sequence of numbers where each number is the sum of the two preceding numbers. The Fibonacci sequence can be defined recursively as:

fib(n) = fib(n-1) + fib(n-2)
Applications of Recursion Algorithms:

Here are some common applications of recursion:


Introduction of Recursion Application's of Recursion Writing base case in Recursion

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4