SlideShare a Scribd company logo
1 of 9
* Back tracking : The General Method
* The 8-Queens Problem
*Sum Of Subsets
* Graph Coloring
ď‚— Backtracking represents one of the most general
techniques. Many problems which deal with searching
for a set solutions or which ask for an optimal solution
satisfying some constraints can be solved using
backtracking formulation.
ď‚— In many applications of the backtrack method the
desired solution is expressible as an n-tuple
(x1,……,xn), Where the xi are chosen from some finite
set Si.
ď‚— For example , Consider the sudoko solving problem, We
try filling digits one by one. Whenever we find that current
digit cannot lead to a solution, We remove it (backtrack)
ď‚— And try next digit. This is better than naĂŻve approach (
generating all possible combination of digits and the trying
every combination one by one) as it drops a set of
permutations whenever it backtracks.
ď‚— The 8-queens problem via a backtracking solution. In
fact we trivially generalize the problem and consider
an n*n chess board and try to find all ways to place n
nonattacking queens.
ď‚— Imagine the chessboard squares being numbered as
the indices of the two-dimensional array a[1:n,1:n],
then we observe that every element on the same
diagonal that runs from the upper left to the lower
right has the same row-column value.
 i – j = k – l (or) i + j = k – l
ď‚— The first equation implies
 j – l = i – k
ď‚— The second equation implies
 j – l = k – i
ď‚— Sum of subsets problem is to find subset of elements
that are selected from a given set whose sum adds up
to a given number k. We are considering the set
contains non-negative values. It is assumed that the
input set is unique (no duplicates are presented ).
ď‚— One way to find subsets that sum to K is to consider all
possible subsets. A Power set contains all those
subsets.
 Assume given set of 4 elements, say W[1]….W[4]. Tree
diagrams can be used to design backtracking algorithms .
The following tree diagram depicts approach of
generating variable sized tuple.
ď‚— Let G be a graph and m be a given positive integer. We
want to discover whether the nodes of G can be
colored in such a way that no two adjacent nodes have
the same color yet only m colors are used. This is
termed the m – colorability decision problem. The d
is the degree of the given graph, then it can be colored
with d+1 colors. The m-colorability optimization
problems asks for the smallest integer m for which the
graph G can be colored.
ď‚— This integer is referred to as the chromatic number of
the graph. For example, the graph can be colored with
three colors 1,2, and3 . The color of each node is indicated
next to it. It can also be seen that three colors are needed
to color this graph and hence this graph’s chromatic
number 3.

More Related Content

What's hot

Graphing linear equations
Graphing linear equationsGraphing linear equations
Graphing linear equationsmathisthenewcool
 
Entropy-Driven Evolutionary Approaches to the Mastermind Problem
Entropy-Driven Evolutionary Approaches to the Mastermind ProblemEntropy-Driven Evolutionary Approaches to the Mastermind Problem
Entropy-Driven Evolutionary Approaches to the Mastermind ProblemJuan J. Merelo
 
Complex Analysis
Complex AnalysisComplex Analysis
Complex AnalysisMijanur Rahman
 
Lecture 3.6 bt
Lecture 3.6 btLecture 3.6 bt
Lecture 3.6 btbtmathematics
 
11.2 graphing linear equations in two variables
11.2 graphing linear equations in two variables11.2 graphing linear equations in two variables
11.2 graphing linear equations in two variablesGlenSchlee
 
Lesson 18
Lesson 18Lesson 18
Lesson 18NRWEG3
 
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...ViscolKanady
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLABPolynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLABShameer Ahmed Koya
 
Sufficient statistics
Sufficient statisticsSufficient statistics
Sufficient statisticsAlessandro Ortis
 
Introduction to engineering maths
Introduction to engineering mathsIntroduction to engineering maths
Introduction to engineering mathsKishore Kumar
 
Alg II 2-7 Transformations
Alg II 2-7 TransformationsAlg II 2-7 Transformations
Alg II 2-7 Transformationsjtentinger
 
5HBC: How to Graph Implicit Relations Intro Packet!
5HBC: How to Graph Implicit Relations Intro Packet!5HBC: How to Graph Implicit Relations Intro Packet!
5HBC: How to Graph Implicit Relations Intro Packet!A Jorge Garcia
 

What's hot (19)

Graphing linear equations
Graphing linear equationsGraphing linear equations
Graphing linear equations
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Entropy-Driven Evolutionary Approaches to the Mastermind Problem
Entropy-Driven Evolutionary Approaches to the Mastermind ProblemEntropy-Driven Evolutionary Approaches to the Mastermind Problem
Entropy-Driven Evolutionary Approaches to the Mastermind Problem
 
Complex Analysis
Complex AnalysisComplex Analysis
Complex Analysis
 
Lecture 3.6 bt
Lecture 3.6 btLecture 3.6 bt
Lecture 3.6 bt
 
11.2 graphing linear equations in two variables
11.2 graphing linear equations in two variables11.2 graphing linear equations in two variables
11.2 graphing linear equations in two variables
 
Lesson 18
Lesson 18Lesson 18
Lesson 18
 
Graph plotting using GeoGebra
Graph plotting using GeoGebraGraph plotting using GeoGebra
Graph plotting using GeoGebra
 
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...
CONSIDER THE INTERVAL [0, ). FOR EACH NUMERICAL VALUE BELOW, IS IT IN THE INT...
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLABPolynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
 
Stochastic Processes Homework Help
Stochastic Processes Homework Help Stochastic Processes Homework Help
Stochastic Processes Homework Help
 
Sufficient statistics
Sufficient statisticsSufficient statistics
Sufficient statistics
 
Math 116 pres. 5
Math 116 pres. 5Math 116 pres. 5
Math 116 pres. 5
 
Introduction to engineering maths
Introduction to engineering mathsIntroduction to engineering maths
Introduction to engineering maths
 
Alg II 2-7 Transformations
Alg II 2-7 TransformationsAlg II 2-7 Transformations
Alg II 2-7 Transformations
 
First Partial Review
First Partial ReviewFirst Partial Review
First Partial Review
 
5HBC: How to Graph Implicit Relations Intro Packet!
5HBC: How to Graph Implicit Relations Intro Packet!5HBC: How to Graph Implicit Relations Intro Packet!
5HBC: How to Graph Implicit Relations Intro Packet!
 
Gr 10 absolute value functions and graphs
Gr 10 absolute value functions and graphsGr 10 absolute value functions and graphs
Gr 10 absolute value functions and graphs
 

Similar to data structure and algorithms Unit 5

Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxB.T.L.I.T
 
Exhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationExhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationMathieu Dutour Sikiric
 
Backtraking pic&def
Backtraking pic&defBacktraking pic&def
Backtraking pic&defbalavigneshwari
 
5.5 back track
5.5 back track5.5 back track
5.5 back trackKrish_ver2
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Deepak John
 
Asssignment problem
Asssignment problemAsssignment problem
Asssignment problemMamatha Upadhya
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam HelpStatistics Exam Help
 
Signals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxSignals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxMatlab Assignment Experts
 
Solution 3.
Solution 3.Solution 3.
Solution 3.sansaristic
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
Perform brute force
Perform brute forcePerform brute force
Perform brute forceSHC
 
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRA
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRARETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRA
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRAmathsjournal
 
Retooling of Color Imaging in ihe Quaternion Algebra
Retooling of Color Imaging in ihe Quaternion AlgebraRetooling of Color Imaging in ihe Quaternion Algebra
Retooling of Color Imaging in ihe Quaternion Algebramathsjournal
 
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphs
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple GraphsGreedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphs
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphsinventionjournals
 

Similar to data structure and algorithms Unit 5 (20)

Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
 
Exhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationExhaustive Combinatorial Enumeration
Exhaustive Combinatorial Enumeration
 
Backtraking pic&def
Backtraking pic&defBacktraking pic&def
Backtraking pic&def
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4
 
Asssignment problem
Asssignment problemAsssignment problem
Asssignment problem
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
 
Daa chapter11
Daa chapter11Daa chapter11
Daa chapter11
 
Signals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxSignals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptx
 
Solution 3.
Solution 3.Solution 3.
Solution 3.
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Back tracking
Back trackingBack tracking
Back tracking
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
 
Perform brute force
Perform brute forcePerform brute force
Perform brute force
 
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRA
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRARETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRA
RETOOLING OF COLOR IMAGING IN THE QUATERNION ALGEBRA
 
Retooling of Color Imaging in ihe Quaternion Algebra
Retooling of Color Imaging in ihe Quaternion AlgebraRetooling of Color Imaging in ihe Quaternion Algebra
Retooling of Color Imaging in ihe Quaternion Algebra
 
Lesson 1 matrix
Lesson 1 matrixLesson 1 matrix
Lesson 1 matrix
 
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphs
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple GraphsGreedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphs
Greedy Edge Colouring for Lower Bound of an Achromatic Index of Simple Graphs
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

data structure and algorithms Unit 5

  • 1. * Back tracking : The General Method * The 8-Queens Problem *Sum Of Subsets * Graph Coloring
  • 2. ď‚— Backtracking represents one of the most general techniques. Many problems which deal with searching for a set solutions or which ask for an optimal solution satisfying some constraints can be solved using backtracking formulation. ď‚— In many applications of the backtrack method the desired solution is expressible as an n-tuple (x1,……,xn), Where the xi are chosen from some finite set Si.
  • 3. ď‚— For example , Consider the sudoko solving problem, We try filling digits one by one. Whenever we find that current digit cannot lead to a solution, We remove it (backtrack) ď‚— And try next digit. This is better than naĂŻve approach ( generating all possible combination of digits and the trying every combination one by one) as it drops a set of permutations whenever it backtracks.
  • 4. ď‚— The 8-queens problem via a backtracking solution. In fact we trivially generalize the problem and consider an n*n chess board and try to find all ways to place n nonattacking queens. ď‚— Imagine the chessboard squares being numbered as the indices of the two-dimensional array a[1:n,1:n], then we observe that every element on the same diagonal that runs from the upper left to the lower right has the same row-column value.
  • 5. ď‚— i – j = k – l (or) i + j = k – l ď‚— The first equation implies ď‚— j – l = i – k ď‚— The second equation implies ď‚— j – l = k – i
  • 6. ď‚— Sum of subsets problem is to find subset of elements that are selected from a given set whose sum adds up to a given number k. We are considering the set contains non-negative values. It is assumed that the input set is unique (no duplicates are presented ). ď‚— One way to find subsets that sum to K is to consider all possible subsets. A Power set contains all those subsets.
  • 7. ď‚— Assume given set of 4 elements, say W[1]….W[4]. Tree diagrams can be used to design backtracking algorithms . The following tree diagram depicts approach of generating variable sized tuple.
  • 8. ď‚— Let G be a graph and m be a given positive integer. We want to discover whether the nodes of G can be colored in such a way that no two adjacent nodes have the same color yet only m colors are used. This is termed the m – colorability decision problem. The d is the degree of the given graph, then it can be colored with d+1 colors. The m-colorability optimization problems asks for the smallest integer m for which the graph G can be colored.
  • 9. ď‚— This integer is referred to as the chromatic number of the graph. For example, the graph can be colored with three colors 1,2, and3 . The color of each node is indicated next to it. It can also be seen that three colors are needed to color this graph and hence this graph’s chromatic number 3.