Introduction to Recursion & Backtracking
Explore recursion and backtracking techniques to understand how recursive function calls and systematic trial-and-error help solve optimization problems. This lesson guides you through base cases, recursive calls, and the backtracking process for efficient problem solving.
We'll cover the following...
Introduction
Backtracking is a general algorithmic technique that considers searching every possible combination order to solve an optimization problem. Backtracking is also known as a depth-first search or branch and bound. The Recursion technique is always used to solve backtracking problems. Let’s start first with Recursion.
Recursion
When a function calls itself, it is called Recursion. We can use the example of the movie Inception (dir. Christopher Nolan, 2010) to understand this. The lead in the film, played by Leonardo DiCaprio had a dream, and in that dream, he had another dream, in which he had yet ...