Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [backtracking]

Backtracking is a general algorithm for finding solutions to some computational problem, that incrementally builds candidates to the solutions, and rejects continued processing of tracks that would lead to impossible solutions.

5
votes
0answers
286 views

Backtracking solver for n queens problem and knight's tour

Playing with https://ocaml.org/learn/tutorials/99problems.html#Miscellaneous-Problems I wrote a backtracking solver for the n queens problem, then the knight's tour, and realised I could generalise ...
4
votes
0answers
785 views

Magic square and backtracking

I have to write a program that solves a NxN Magic Square, with digits from 1 to N2. What do you think? ...
3
votes
0answers
2k views

C# recursive backtracker labyrinth generation & game

So for over a weekend I decided to write something rather simple. For maze generation I've followed this algorithm and aside from that I've made a little game, to go from A to B. Everything works fine ...
1
vote
0answers
56 views

I have written two versions of Word Break exhaustive combinations. Please comment

I am solving Word Break II from leetcode. https://leetcode.com/problems/word-break-ii/description/ Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add ...
1
vote
0answers
91 views

Using most constraining variable and least constraining value for N-queens challenge

I was trying to solve the N-Queens(Only 1 solution) problem and I succeeded but my program could only calculate up to N = 47 in a good amount of time so I tried to implement least constraining value ...
1
vote
0answers
76 views

Ruby Sudoku Solver without classes

I'm writing a Sudoku solver in Ruby to complete a coding challenge with the following restrictions. Failing to follow the following restrictions will result in an invalid submission: Do ...