[algogeeks] Sudoku verification problem

2011-05-28 Thread Dumanshu
Given a n by n matrix. Suggest an algorithm to verify its correctness given a configuration. User can enter numbers only between 1 to n. I need this in 2 ways - 1. for the n by n matrix, suggest an elegant way for validating it. 2. suggest a data structure for this sudoku so that the structure

Re: [algogeeks] Sudoku verification problem

2011-05-28 Thread Vishal Thanki
here is the code.. #define bi (i) #define bj (GRID_SIZE+j) #define bk (int)((GRID_SIZE*2)+(glb_sqrt*(i/glb_sqrt)+(j/glb_sqrt))) /*glb_sqrt should be the square root of grid_size (i.e. 3 if its a 9x9 sudoku). */ /* #define bk (int)((GRID_SIZE*2)+(5*(i/5)+(j/5))) */ /* * This function will

Re: [algogeeks] Sudoku verification problem

2011-05-28 Thread Vishal Thanki
Forgot to mention that you have to fill the bitmap before calling this routine. This code is the part of the actual sudoku solver code. Here is the bitmap filling code which is very simple.. void fill_bitmap(int *bmp) { int i, j; for (i = 0; i GRID_SIZE; i++) {