Search code examples
javac++algorithmn-queens

8 queens problem


How can i go about implemting 8/4 queens problem?Should i use DFS/BFS,I think DFs will be better. Can any one give some pseudocode/guidlines?


Solution

  • Use a stack and backtracking, easiest way is via recursion.

    See these other SO posts:

    Dumb 8 Queens problem in C++