1 / 16

backtracking

Design and analysis of Algorithms backtracking

syamradhe
Download Presentation

backtracking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LectureON Backtracking V.Radhesyam Assistant professor Department of IT:VRSEC

  2. What is Backtracking • Backtracking is a design technique used to solve problems with large search space. • Build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time. • Backtracking uses a data structure called state space tree.

  3. What is 4-Queens Problem • The 4-Queens Problem consists in placing four queens on a 4 x 4 chessboard so that no two queens can attack each other. • That is, no two queens are allowed to be placed on the same row, the same column or the same diagonal. • This problem can be solved by backtracking

  4. Complete State space Tree

  5. Solution: State space Tree x1=1 means Q1 Placed in first column

  6. Chess board example

  7. Types of nodes • Live node: A node which is generated and the children are not yet generated is called live node. • E-node: The node whose children are currently generated is called E-node. • Dead node: A node which cannot further extended is called dead node.

  8. Control abstraction

  9. Graph coloring • The problem is, given m colors, find a way of coloring the vertices of a graph such that no two adjacent vertices are colored using same color. • This number is called chromatic number

  10. Hamilton cycles • Hamiltonian Path in an undirected graph is a path that visits each vertex exactly once. A Hamiltonian cycle is a Hamiltonian Path such that there is an edge (in graph) from the last vertex to the first vertex of the Hamiltonian Path

  11. Design Techniques

  12. Sum of Subsets Problem

  13. Fixed Tuple Size

  14. Variable Tuple Size

  15. Algorithm

  16. Practice

More Related