back-tracking

Back Tracking

Back tracking is a method to solve problems by making a series of choices that we can back track to

  • A brute force approach

  • Used when there are multiple solutions and you want all those solutions

How to know it is a back tracking problem? When it says stuff like “Generate all” “Compute all”


State Space Tree

Example of ppossible seating arrangements for 2 boys and 1 girl

Example of ppossible seating arrangements for 2 boys and 1 girl

Can use a state space tree to represent the possible list of solutions for a given backtracking problem


3 keys by “Back to Back SWE” Youtube

  1. Choice

    1. What choice to make at each call of function?

  2. Constraints

    1. When to stop following a certain path?

  3. Goal

    1. What are we trying to find? What is the target ?

Last updated