6.2 Sum of Subset, Hamiltonian Cycle
6.2 Sum of Subset, Hamiltonian Cycle
UNIVERSITY INSTITUTE OF
ENGINEERING
COMPUTER SCIENCE
ENGINEERING
Bachelor of Engineering
Design and Analysis of
Algorithms(CSH-311/ITH-311)
Outcome:
• Student will understand
Sum-of-subsets
Hamiltonian cycles
Subset-Sum Problem
Example
• Given a set S = (3, 4, 5, 6) and X =9. Obtain the subset sum using
Backtracking approach.
Solution:
• Initially S = (3, 4, 5, 6) and X =9.
• S'= (∅)
The implicit binary tree for the subset sum problem is shown as fig:
REFERENCES
Text books:
•Cormen, Leiserson, Rivest, Stein, “Introduction to Algorithms”, Prentice Hall of
India, 3rd edition 2012. problem, Graph coloring.
Websites:
•https://www.javatpoint.com/subset-sum-problems
•https://www.javatpoint.com/hamiltonian-circuit-problems
Summary
Backtracking:
• Sum-of-subsets
• Hamiltonian cycles