Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 441
akshay Avatar asked Dec 28 '25 01:12

akshay


1 Answers

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

See these other SO posts:

Dumb 8 Queens problem in C++

like image 99
Robert S. Barnes Avatar answered Dec 30 '25 16:12

Robert S. Barnes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!