![]() |
VOOZH | about |
If you have ever tried to create a program for solving Sudoku, you might have come across the Exact Cover problem. We will discuss what is the exact cover problem and an algorithm “Algorithm X” proposed by Donald Knuth to solve this problem. Given a collection S of subsets of set X, an exact cover is the subset S* of S such that each element of X is contained is exactly one subset of S*.
It should satisfy following two conditions -
Example (standard representation) - Let S = { A, B, C, D, E, F } and X = {1, 2, 3, 4, 5, 6, 7} such that -
Then S* = {B, D, F} is an exact cover, because each element in X is contained exactly once in subsets {B, D, F} . If we union subsets then we will get all the elements of X -