...

/

Introduction to Recursion & Backtracking

Introduction to Recursion & Backtracking

Learn the logic building for Recursion and Backtracking.

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 another dream, and so on. ...