Can anyone provide me the implementation and tutorial on Aho Corasick algorithms and some problems containing aho corasick algorithm.
An algorithm to generate a random unsolved Sudoku whose only a unique solution exist.
Can anyone provide me the implementation and tutorial on Aho Corasick algorithms and some problems containing aho corasick algorithm.
An algorithm to generate a random unsolved Sudoku whose only a unique solution exist.
Aho Corasic Problem:
LightOJ 1427 — Substring Frequency (II)
CodeChef Music & Lyrics
Ahmed Aly's Site contains more problems.
Aho Corasick .This link is from wikipedia. The explanation is not absolutely clear but using my code you will understand it. I have named my variables according to the wikipedia post, so you can swap between webpage and source code.Here is the code. I hope that this would be helpful
I don't think this could be so fast but it could make a random Sudoku in a few seconds. It's is very easy to solve a Sudoku by backtracing with little time. To generate a random unsolve Sudoku, firstly, create a finish state. Afterward, try to remove one cell in this state, then check the number of solotion (by backtracking). If this number = 0, you must undo your action, if this number >= 2, you could repeat this action.
Question 2
Your definition of "random" is underspecified. Uniformly random from all possible unique Sudoku puzzles? (This is insane and I doubt there is a better way than lookup of a gigantic table.) Simply generate a unique Sudoku puzzle that is sufficiently random? Just generate a valid Sudoku grid and remove a random square. Three squares, if you wish (this is the largest that can still ensure a unique solution).
Or you want to make a nice Sudoku puzzle that is human solvable? That is called intelligence and creativity. There's a reason why there are many popular pencil puzzle constructors (most notably Thomas Snyder for Sudoku perhaps?) whose puzzles are not boring/computer-generated.
Can you give a basic idea to generate human solvable puzzle using computer.
I have got the algorithm by ACRUSH to solve the problem, but i am unable to code it.
can anyone code it for mr ?