BACKTRACK SEARCH
ALGORITHM
CONTENT
 Introduction
 Backtracking
 Backtrack Algorithm
 Backtracking EXAMPLE—8 Queens Problem
 References
INTRODUCTION
 Suppose you have to make a series of decisions,
among various choices, where
 You don’t have enough information to know what to
choose
 Each decision leads to a new set of choices
 Some sequence of choices (possibly more than one)
may be a solution to your problem
INTRODUCTION
 The term "backtrack" was coined by American
mathematician D. H. Lehmer in the 1950s
 R.J Walker was the First man who gave algorithmic
description in 1960
 Later developed by S. Golamb and L. Baumert
https://en.wikipedia.org/wiki/Backtracking
BACKTRACKING
 Backtracking is a methodical way of trying out
various sequences of decisions, until you find the
correct one that “works”.
BACKTRACKING
 Backtracking is used to solve problems in which a
sequence of objects is chosen from a specified set
so that the sequence satisfies some criterion.
 Backtracking is a modified depth-first search of a
tree.
 It is the procedure whereby, after determining that a
node can lead to nothing but dead nodes, we go
back (“backtrack”) to the node’s parent and proceed
with the search on the next child.
BACKTRACK ALGORITHM
 Based on depth-first recursive search
 Approach
1. Tests whether solution has been found
2. If found solution, return it
3. Else for each choice that can be made
a) Make that choice
b) Recursive
c) If recursion returns a solution, return it
4. If no choices remain, return failure
 Some times called “search tree”
IMPROVING BACKTRACKING
 Search pruning will help us to reduce the search
space and hence get a solution faster.
 The idea is to avoid those paths that may not lead
to a solutions as early as possible by finding
contradictions so that we can backtrack
immediately without the need to build a hopeless
solution vector.
BACKTRACKING EXAMPLES
 The backtracking can be used in this cases:
 Solving a maze
 Coloring a map
 Solving a puzzle
 N queens problem etc.,
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM
 The 8-queens problem is a classical combinatorial
problem in which it is required to place eight
queens on an 8 x 8 chessboard so no two can
attack each other.
 A queen can attack another queen if it exists in the
same row, column or diagonal as the queen.
10
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 This problem can be solved by trying to place the
first queen, then the second queen so that it cannot
attack the first, and then the third so that it is not
conflicting with previously placed queens.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 It is an empty 8 x 8
chess board. We have
to place the queens in
this board.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 We have placed the
first queen on the
chess board
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 Then we have placed
the second queen on
the board.
 The darken place
should not have the
queens because they
are horizontal, vertical,
diagonal to the placed
queens.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 We have placed the
third queen on board.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 We have placed the 4th
queen on the board.
 We have placed that in
the wrong spot, so we
backtrack and change
the place of that one.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 In this way, we have to
continue the process
untill our is reached ie.,
we must place 8
queens on the board.
BACKTRACKING EXAMPLE—8 QUEENS
PROBLEM(CONT…)
 Backtracking provides the hope to solve some
problem instances of nontrivial sizes by pruning
non-promising branches of the state-space tree.
 The success of backtracking varies from problem
to problem and from instance to instance.
 Backtracking possibly generates all possible
candidates in an exponentially growing state-
space tree.
REFERENCES
 https://en.wikipedia.org/wiki/Backtracking
 https://en.wikipedia.org/wiki/R._B._J._Walker
 http://www.arch.cs.titech.ac.jp/~kise/doc/paper/uec-
is-2004-06.pdf
 https://en.wikipedia.org/wiki/D._H._Lehmer
THANK YOU!!!

More Related Content

PPTX
Backtrack search-algorithm
PPTX
Backtracking Basics.pptx
PPTX
Branch and bound
PPTX
8queensproblemusingbacktracking-120903114053-phpapp01.pptx
PPTX
Back tracking and branch and bound class 20
PPTX
Backtracking
PPT
5.5 back track
PPTX
8 QUEENS PROBLEM.pptx
Backtrack search-algorithm
Backtracking Basics.pptx
Branch and bound
8queensproblemusingbacktracking-120903114053-phpapp01.pptx
Back tracking and branch and bound class 20
Backtracking
5.5 back track
8 QUEENS PROBLEM.pptx

Similar to Backtrack-search-algorithm (2).pptx (13)

PPT
BackTracking Algorithm: Technique and Examples
PPTX
data structures- back tracking
PDF
module5_backtrackingnbranchnbound_2022.pdf
PDF
unit 4 of Unit 4 of design and analysis of algorithms
PDF
G374044.pdf
PDF
G374044.pdf
PDF
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
PDF
matrices-1.pdf
PPTX
Design Algorithms - - Backtracking.pptx
PDF
Algorithm Performance For Chessboard Separation Problems
PPTX
N-queens.pptx
PPTX
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
BackTracking Algorithm: Technique and Examples
data structures- back tracking
module5_backtrackingnbranchnbound_2022.pdf
unit 4 of Unit 4 of design and analysis of algorithms
G374044.pdf
G374044.pdf
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
matrices-1.pdf
Design Algorithms - - Backtracking.pptx
Algorithm Performance For Chessboard Separation Problems
N-queens.pptx
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Ad

Recently uploaded (20)

PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
UiPath Agentic Automation session 1: RPA to Agents
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
Build Your First AI Agent with UiPath.pptx
PPTX
TEXTILE technology diploma scope and career opportunities
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PPTX
Modernising the Digital Integration Hub
PDF
Architecture types and enterprise applications.pdf
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
Comparative analysis of machine learning models for fake news detection in so...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
CloudStack 4.21: First Look Webinar slides
PDF
A review of recent deep learning applications in wood surface defect identifi...
sbt 2.0: go big (Scala Days 2025 edition)
Enhancing plagiarism detection using data pre-processing and machine learning...
Microsoft Excel 365/2024 Beginner's training
UiPath Agentic Automation session 1: RPA to Agents
Final SEM Unit 1 for mit wpu at pune .pptx
Build Your First AI Agent with UiPath.pptx
TEXTILE technology diploma scope and career opportunities
Custom Battery Pack Design Considerations for Performance and Safety
Getting started with AI Agents and Multi-Agent Systems
Convolutional neural network based encoder-decoder for efficient real-time ob...
Modernising the Digital Integration Hub
Architecture types and enterprise applications.pdf
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
The influence of sentiment analysis in enhancing early warning system model f...
Comparative analysis of machine learning models for fake news detection in so...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
STKI Israel Market Study 2025 version august
Credit Without Borders: AI and Financial Inclusion in Bangladesh
CloudStack 4.21: First Look Webinar slides
A review of recent deep learning applications in wood surface defect identifi...
Ad

Backtrack-search-algorithm (2).pptx