# What is the difference between Backtracking and Recursion?

• Difficulty Level : Basic
• Last Updated : 18 Nov, 2022

## What is Recursion?

The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function.

### Properties of Recursion:

• Performing the same operations multiple times with different inputs.
• In every step, we try smaller inputs to make the problem smaller.
• A base condition is needed to stop the recursion otherwise infinite loop will occur.

## What is Backtracking?

Backtracking is an algorithmic technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point in time (by time, here, is referred to the time elapsed till reaching any level of the search tree).

Backtracking can be defined as a general algorithmic technique that considers searching every possible combination in order to solve a computational problem.

### There are three types of problems in backtracking:

• Decision Problem – In this, we search for a feasible solution.
• Optimization Problem – In this, we search for the best solution.
• Enumeration Problem – In this, we find all feasible solutions.

## What is the difference between Backtracking and Recursion?

Related Articles:

My Personal Notes arrow_drop_up