puzzle

This tag is associated with 2 posts

C++: N-Queens Problem

Solve the eight queens puzzle. You can extend the problem to solve the puzzle with a board of side NxN. For the number of solutions for small values of N, see oeis.org // Much shorter than the version below; // uses C++11 threads to parallelize the computation; also uses backtracking // Outputs all solutions for … Continue reading »

C++: Dutch National Flag Problem

The Dutch national flag is composed of three coloured bands in the order red then white and lastly blue. The problem posed by Edsger Dijkstra is: Given a number of red, blue and white balls in random order, arrange them in the order of the colours Dutch national flag. When the problem was first posed, … Continue reading »

UC Berkeley MFE Sideboard

Become a TFE Insider!