Skip to content

An implementation of Donald Knuth's Algorithm X (that solves the exact cover problem). For educational purposes.

License

Notifications You must be signed in to change notification settings

AlexeyFeigin/algorithm-x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An implementation of Donald Knuth's Algorithm X (that solves the exact cover problem). For educational purposes.

Get dependencies

$ cabal build

Play around

$ cd src
$ ghci

Load the demo module:

ghci> :l Demo.hs     
[1 of 2] Compiling AlgorithmX       ( AlgorithmX.hs, interpreted )
[2 of 2] Compiling Demo             ( Demo.hs, interpreted )
Ok, two modules loaded.

Explore:

ghci> print m1

+---++---+---+---+---+---+---+---+
|   || 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+===++===+===+===+===+===+===+===+
| 0 || 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 1 || 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| 2 || 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 3 || 0 | 0 | 1 | 0 | 1 | 1 | 0 |
| 4 || 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 5 || 0 | 1 | 0 | 0 | 0 | 0 | 1 |
+---++---+---+---+---+---+---+---+

ghci> algoX m1
[[5,3,1]]

About

An implementation of Donald Knuth's Algorithm X (that solves the exact cover problem). For educational purposes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages