Last active
September 14, 2015 21:02
-
-
Save KasaiMagi/9fcc9ec98adf70918123 to your computer and use it in GitHub Desktop.
backtracking pseudocode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool Solve(configuration conf) { | |
if (no more choices) { // BASE CASE | |
return (conf is goal state) | |
} | |
for (all available choices) { | |
try one choice C: | |
// solve from here, if works out, you're done | |
if (Solve(conf with choice c made)) return true; | |
unmake choice c; | |
} | |
return false; // tried all choices, no soln found | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment