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
/* CC150 9.9 */ | |
// n queens | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
bool checkValid(vector<int> columns, int row) // return true if placement on (row) is valid | |
{ |
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
/* CC150 5.3 | |
* Given a positive integer, print the next smallest and the next largest number that have the same number of | |
* 1 bits in their binary representation. | |
*/ | |
#include <iostream> | |
using namespace std; | |
unsigned int reverse(unsigned int num, int k); // reverse from LSB through the kth bit, k < BIT_SIZE |