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
// This program searches a dictionary for palindromic word squares, such as | |
// the famous SATOR square: | |
// | |
// SATOR | |
// AREPO | |
// TENET | |
// OPERA | |
// ROTAS | |
// | |
// Palindromic word squares read the same forwards, backwards and up and down. |
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
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
// This class solves the Chinese Rings puzzle (https://en.wikipedia.org/wiki/Baguenaudier), | |
// optionally printing each move, and tells you how many moves it takes to solve it. It runs in O(2^N) | |
// time, because it actually simulates each move and it takes 2^N - 1 moves in the worst case. | |
class ChineseRings { | |
public: |
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
#include <iostream> | |
#include <exception> | |
#include <string> | |
#include "trycatchfinally.h" | |
using namespace std; | |
int main() | |
{ | |
// No exception | |
TryFinally( |