SlideShare a Scribd company logo
2
Most read
4
Most read
7
Most read
Brute Force Approach
Backtracking
Backtracking
Backtracking is nothing but the
modified process of the Brute
Force approach. which will try
for every possible solutions,
then from which select the
optimum solution or select
best possible solution. It does
so by assuming that the
solutions are represented by
vectors ( vi
……………in) of values and by
traversing through the domains
of the vectors until the
solutions is found.
Backtracking- Introduction
 Suppose we have to make a series of decisions, among
various choices, where we 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 our problem.
 Backtracking is a methodical way of trying out various
sequences of decisions, until you find one that “works”.
Backtracking and Recursion
 Backtracking is easily implemented with recursion
because:
 The run-time stack takes care of keeping track of
the choices that got us to a given point.
 Upon failure we can get to the previous choice
simply by returning a failure code from the recursive
call.
Backtracking :General Method
 Backtracking is used to solve problem in which a
sequence of objects is chosen from a specified set so
that the sequence satisfies some criterion.
 The desired solution is expressed as an n-tuple
(x1……… xn) where each xi Є S, S being a finite set.
 The solution is based on finding one or more vectors
that maximize, minimize, or satisfy a criterion function
P((x1……… xn) .
 Form a solution and check at every step if this has
any chance of success. If the solution at any point
seems not promising, ignore it.
 All solutions requires a set of constraints divided into
two categories: Explicit and implicit constraints.
Explicit & implicit Constraints
 Explicit constraints are rules that restrict each
xi to take on values only from a given set. Explicit
constraints depend on the particular instance I of
problem being solved.
 Implicit constraints are rules that determine
which of the tuples in the solution space of I
satisfy the criterion function. Thus, implicit
constraints describe the way in which the xi’s
must relate to each other.
 The implicit constraints narrow the solution space
down to an answer space.
Explicit & implicit Constraints
 Explicit Constraints are rules which restrict the
values of xi . Example xi>=0 or xi =0 or 1 or
Li<=xi<=Ui.
 All tuples that satisfy the explicit constraints
define a possible solution space for I.
 Implicit Constraints describe the way in which the
xi must relate to each other.
 Implicit Constraints allow to find those tuples in
the solution space that satisfy the criterion
function.
Backtracking :General Method
 Backtracking is a modified depth first search of a tree.
 Backtracking algorithms determine problem solutions by
systematically searching the solution space for the given
problem instance. This search is facilitated by using a tree
organization for
the solution space.
 Backtracking is the procedure whereby, after determining that a
node can lead to nothing but dead end, we go back (backtrack)
to the nodes parent and proceed with the search on the next
child.
 A backtracking algorithm need not actually create a tree. Rather,
it only needs to keep track of the values in the current branch
being investigated. This is the way we implement backtracking
algorithm. We say that the state space tree exists implicitly in
the algorithm because it is not actually constructed.
State Space Tree
 Its root represents an initial state before the search for a
solution begins.
 State space is the set of paths from root node to other
nodes.
 State space tree is the tree organization of the solution
space.
 A state-space tree for a backtracking algorithm is
constructed in the manner of depth-first search.
 A node in a state-space tree is said to be promising if it
corresponds to a partially constructed solution that may still
lead to a complete solution; otherwise,
 it is called nonpromising. Leaves represent either
nonpromising dead ends or complete solutions found by the
algorithm.
Backtracking
how we find out all the permutations. If you are given three numbers [1,2,3]
Backtracking
Backtracking
 Problem: Find out all 3-bit binary numbers for
which the sum of the 1's is greater than or equal
to 2.
 The only way to solve this problem is to check all
the possibilities: (000, 001, 010, ....,111)
 The 8 possibilities are called the search space of
the problem. They can be organized into a tree
which is called State Space Tree.
Backtracking
Terminology
 Problem state is each node in the depth first search
tree.
 Solution states are the problem states “S” for which
the path from the root node to “S” defines a tuple in
the solution space.
 Answer states are those solution states for which the
path from root node to S defines a tuple that is a
member of the set of solutions.
 Live node is a node that has been generated but
whose children have not yet been generated.
 E-node is a live node whose children are currently
being explored. In other words, an E-node is a node
currently being expanded.
 Dead node is a generated node that is not to be
expanded or explored any further. All children of a
dead node have already been expanded.
Sum of subsets problem
 Problem definition: Find a subset of a given set A
= {a1, . . . , an} of n positive integers whose sum
is equal to a given positive integer d.
 For example, for A = {1, 2, 5, 6, 8} and d = 9,
 there are two solutions: {1, 2, 6} and {1, 8}. Of
course, some instances of this problem may have
no solutions. It is convenient to sort the set’s
elements in increasing order. So, we will assume
that a1< a2< . . . < an.
Sum of subsets problem
Problems
Ad

Recommended

Disjoint sets union, find
Disjoint sets union, find
subhashchandra197
 
Branch & bound
Branch & bound
kannanchirayath
 
Red black tree
Red black tree
uos lahore
 
Doubly & Circular Linked Lists
Doubly & Circular Linked Lists
Afaq Mansoor Khan
 
Data structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptx
MalligaarjunanN
 
Red black tree
Red black tree
Rajendran
 
Breadth first search and depth first search
Breadth first search and depth first search
Hossain Md Shakhawat
 
Red black trees
Red black trees
Amit Kumar Rathi
 
Sorting algorithms
Sorting algorithms
Trupti Agrawal
 
Sorting Techniques
Sorting Techniques
Rafay Farooq
 
linear search and binary search
linear search and binary search
Zia Ush Shamszaman
 
Data Structure and Algorithms The Tower of Hanoi
Data Structure and Algorithms The Tower of Hanoi
ManishPrajapati78
 
Red black tree
Red black tree
Dr Sandeep Kumar Poonia
 
Topological Sort
Topological Sort
Dr Sandeep Kumar Poonia
 
Tree Traversal
Tree Traversal
Md. Israil Fakir
 
linked lists in data structures
linked lists in data structures
DurgaDeviCbit
 
Unit 5 linked list
Unit 5 linked list
Dabbal Singh Mahara
 
Linear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Hashing in datastructure
Hashing in datastructure
rajshreemuthiah
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
Anand Ingle
 
2-3 Tree
2-3 Tree
Dr Sandeep Kumar Poonia
 
Insertion sort
Insertion sort
Monalisa Patel
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
Data Structure & Algorithms - Operations
Data Structure & Algorithms - Operations
babuk110
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
SeethaDinesh
 
Sorting method data structure
Sorting method data structure
sunilchute1
 
Data structure tries
Data structure tries
Md. Naim khan
 
LR(0) Parsing.pptx
LR(0) Parsing.pptx
SubhamMukherjee29
 
General methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptx
LakshmiSamivel
 
Backtracking (11111111111111111111).pptx
Backtracking (11111111111111111111).pptx
5dftmtp4ws
 

More Related Content

What's hot (20)

Sorting algorithms
Sorting algorithms
Trupti Agrawal
 
Sorting Techniques
Sorting Techniques
Rafay Farooq
 
linear search and binary search
linear search and binary search
Zia Ush Shamszaman
 
Data Structure and Algorithms The Tower of Hanoi
Data Structure and Algorithms The Tower of Hanoi
ManishPrajapati78
 
Red black tree
Red black tree
Dr Sandeep Kumar Poonia
 
Topological Sort
Topological Sort
Dr Sandeep Kumar Poonia
 
Tree Traversal
Tree Traversal
Md. Israil Fakir
 
linked lists in data structures
linked lists in data structures
DurgaDeviCbit
 
Unit 5 linked list
Unit 5 linked list
Dabbal Singh Mahara
 
Linear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Hashing in datastructure
Hashing in datastructure
rajshreemuthiah
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
Anand Ingle
 
2-3 Tree
2-3 Tree
Dr Sandeep Kumar Poonia
 
Insertion sort
Insertion sort
Monalisa Patel
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
Data Structure & Algorithms - Operations
Data Structure & Algorithms - Operations
babuk110
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
SeethaDinesh
 
Sorting method data structure
Sorting method data structure
sunilchute1
 
Data structure tries
Data structure tries
Md. Naim khan
 
LR(0) Parsing.pptx
LR(0) Parsing.pptx
SubhamMukherjee29
 

Similar to Backtracking in Data Structure and Algorithm (20)

General methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptx
LakshmiSamivel
 
Backtracking (11111111111111111111).pptx
Backtracking (11111111111111111111).pptx
5dftmtp4ws
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
dakccse
 
Optimization problems
Optimization problems
Ruchika Sinha
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
AmitBhola17
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
ZeelGoyani
 
module5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdf
Shiwani Gupta
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
BinayakMukherjee4
 
Backtracking
Backtracking
Vikas Sharma
 
Algo
Algo
Raghu nath
 
Backtrack search-algorithm
Backtrack search-algorithm
Ruchika Sinha
 
Design Algorithms - - Backtracking.pptx
Design Algorithms - - Backtracking.pptx
Kishor767966
 
Backtracking
Backtracking
Sally Salem
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
B.T.L.I.T
 
Maze Path Finding
Maze Path Finding
MdShanewazAkib1
 
it is a ppt discussing important topic of daa such as branch and bound.pptx
it is a ppt discussing important topic of daa such as branch and bound.pptx
rajbaibhav004
 
Backtracking
Backtracking
Raghu nath
 
Backtrack-search-algorithm (2).pptx
Backtrack-search-algorithm (2).pptx
AnLPhc1
 
backtracking 8 Queen.pptx
backtracking 8 Queen.pptx
JoshipavanEdduluru1
 
5.5 back track
5.5 back track
Krish_ver2
 
General methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptx
LakshmiSamivel
 
Backtracking (11111111111111111111).pptx
Backtracking (11111111111111111111).pptx
5dftmtp4ws
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
dakccse
 
Optimization problems
Optimization problems
Ruchika Sinha
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
AmitBhola17
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
ZeelGoyani
 
module5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdf
Shiwani Gupta
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
BinayakMukherjee4
 
Backtrack search-algorithm
Backtrack search-algorithm
Ruchika Sinha
 
Design Algorithms - - Backtracking.pptx
Design Algorithms - - Backtracking.pptx
Kishor767966
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
B.T.L.I.T
 
it is a ppt discussing important topic of daa such as branch and bound.pptx
it is a ppt discussing important topic of daa such as branch and bound.pptx
rajbaibhav004
 
Backtrack-search-algorithm (2).pptx
Backtrack-search-algorithm (2).pptx
AnLPhc1
 
5.5 back track
5.5 back track
Krish_ver2
 
Ad

Recently uploaded (20)

THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Rajdeep Bavaliya
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Rajdeep Bavaliya
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
Filipino 9 Maikling Kwento Ang Ama Panitikang Asiyano
sumadsadjelly121997
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
Ad

Backtracking in Data Structure and Algorithm

  • 2. Backtracking Backtracking is nothing but the modified process of the Brute Force approach. which will try for every possible solutions, then from which select the optimum solution or select best possible solution. It does so by assuming that the solutions are represented by vectors ( vi ……………in) of values and by traversing through the domains of the vectors until the solutions is found.
  • 3. Backtracking- Introduction  Suppose we have to make a series of decisions, among various choices, where we 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 our problem.  Backtracking is a methodical way of trying out various sequences of decisions, until you find one that “works”.
  • 4. Backtracking and Recursion  Backtracking is easily implemented with recursion because:  The run-time stack takes care of keeping track of the choices that got us to a given point.  Upon failure we can get to the previous choice simply by returning a failure code from the recursive call.
  • 5. Backtracking :General Method  Backtracking is used to solve problem in which a sequence of objects is chosen from a specified set so that the sequence satisfies some criterion.  The desired solution is expressed as an n-tuple (x1……… xn) where each xi Є S, S being a finite set.  The solution is based on finding one or more vectors that maximize, minimize, or satisfy a criterion function P((x1……… xn) .  Form a solution and check at every step if this has any chance of success. If the solution at any point seems not promising, ignore it.  All solutions requires a set of constraints divided into two categories: Explicit and implicit constraints.
  • 6. Explicit & implicit Constraints  Explicit constraints are rules that restrict each xi to take on values only from a given set. Explicit constraints depend on the particular instance I of problem being solved.  Implicit constraints are rules that determine which of the tuples in the solution space of I satisfy the criterion function. Thus, implicit constraints describe the way in which the xi’s must relate to each other.  The implicit constraints narrow the solution space down to an answer space.
  • 7. Explicit & implicit Constraints  Explicit Constraints are rules which restrict the values of xi . Example xi>=0 or xi =0 or 1 or Li<=xi<=Ui.  All tuples that satisfy the explicit constraints define a possible solution space for I.  Implicit Constraints describe the way in which the xi must relate to each other.  Implicit Constraints allow to find those tuples in the solution space that satisfy the criterion function.
  • 8. Backtracking :General Method  Backtracking is a modified depth first search of a tree.  Backtracking algorithms determine problem solutions by systematically searching the solution space for the given problem instance. This search is facilitated by using a tree organization for the solution space.  Backtracking is the procedure whereby, after determining that a node can lead to nothing but dead end, we go back (backtrack) to the nodes parent and proceed with the search on the next child.  A backtracking algorithm need not actually create a tree. Rather, it only needs to keep track of the values in the current branch being investigated. This is the way we implement backtracking algorithm. We say that the state space tree exists implicitly in the algorithm because it is not actually constructed.
  • 9. State Space Tree  Its root represents an initial state before the search for a solution begins.  State space is the set of paths from root node to other nodes.  State space tree is the tree organization of the solution space.  A state-space tree for a backtracking algorithm is constructed in the manner of depth-first search.  A node in a state-space tree is said to be promising if it corresponds to a partially constructed solution that may still lead to a complete solution; otherwise,  it is called nonpromising. Leaves represent either nonpromising dead ends or complete solutions found by the algorithm.
  • 10. Backtracking how we find out all the permutations. If you are given three numbers [1,2,3]
  • 12. Backtracking  Problem: Find out all 3-bit binary numbers for which the sum of the 1's is greater than or equal to 2.  The only way to solve this problem is to check all the possibilities: (000, 001, 010, ....,111)  The 8 possibilities are called the search space of the problem. They can be organized into a tree which is called State Space Tree.
  • 14. Terminology  Problem state is each node in the depth first search tree.  Solution states are the problem states “S” for which the path from the root node to “S” defines a tuple in the solution space.  Answer states are those solution states for which the path from root node to S defines a tuple that is a member of the set of solutions.  Live node is a node that has been generated but whose children have not yet been generated.  E-node is a live node whose children are currently being explored. In other words, an E-node is a node currently being expanded.  Dead node is a generated node that is not to be expanded or explored any further. All children of a dead node have already been expanded.
  • 15. Sum of subsets problem  Problem definition: Find a subset of a given set A = {a1, . . . , an} of n positive integers whose sum is equal to a given positive integer d.  For example, for A = {1, 2, 5, 6, 8} and d = 9,  there are two solutions: {1, 2, 6} and {1, 8}. Of course, some instances of this problem may have no solutions. It is convenient to sort the set’s elements in increasing order. So, we will assume that a1< a2< . . . < an.
  • 16. Sum of subsets problem