Blog Archive

ShareThis

For the love of Coding...



Pseudocode

In order to apply backtracking to a specific class of problems, one must provide the data P for the particular instance of the problem that is to be solved, and six procedural parametersrootrejectacceptfirstnext, and output. These procedures should take the instance data P as a parameter and should do the following:
  1. root: return the partial candidate at the root of the search tree.
  2. reject(P,c): return true only if the partial candidate c is not worth completing.
  3. accept(P,c): return true if c is a solution of P, and false otherwise.
  4. first(P,c): generate the first extension of candidate c.
  5. next(P,s): generate the next alternative extension of a candidate, after the extension s.
  6. output(P,c): use the solution c of P, as appropriate to the application.
The backtracking algorithm reduces then to the call bt(root(P)), where bt is the following recursive procedure:
procedure bt(c)
   if reject(P,c) then return
   if accept(P,c) then output(P,c)
   sfirst(P,c)
   while s ≠ Λ do
     bt(s)
     snext(P,s)



http://www.cse.ohio-state.edu/~gurari/course/cis680/cis680Ch19.html

CROSSWORD PUZZLE PROBLEM

http://www.cis.temple.edu/~ingargio/cis587/readings/constraints.html

N QUEENS PROBLEM

http://faculty.cs.byu.edu/~ringger/Winter2008-CS312/lectures/Lecture31-backtracking.pdf

N QUEENS ,GRAPH COLOURING AND HAMILTONIAN CIRCUIT  ALGORITHM

http://www.adeli.ir/courses/algorithms_fall2008/Chapter%205%20-%20Backtracking.pdf