302 Defective Chessboard
302 Defective Chessboard
2 Defective Chessboard
Tiling A Defective Chessboard
4 Defective Chessboard
A Defective Chessboard
A defective chessboard is a chessboard that has one unavailable
(defective) position.
5 Defective Chessboard
A Triomino
A triomino is an L shaped object that can cover three squares of a
chessboard.
A triomino has four orientations.
6 Defective Chessboard
Tromino Tiling
A triomino tile:
7 Defective Chessboard
Tiling A Defective Chessboard
Place (n2 - 1)/3 triominoes on an n × n defective chessboard so that
all n2 - 1 non-defective positions are covered.
9 Defective Chessboard
Proof by Induction: 2n×2n defective chessboard can be covered with (22n - 1) /3
triominoes
For n = 2, A 4×4 chess board requires (22n - 1) /3 = 5 number of
Triomino to cover the defective chessboard.
10 Defective Chessboard
Proof by Induction: 2n×2n defective chessboard can be covered with (22n - 1) /3
triominoes
Assume that induction hypothesis is true for any n; n > 0.
Now to prove hypothesis is true for n+1
4 ×(22n - 1) /3 + 1 = 22 ×(22n - 1) /3 +1= (22n+1 - 4) /3 +1
= (22n+1 – 4 +3) /3 = (22n+1 – 1) /3
11 Defective Chessboard
Tiling A Defective Chessboard
A simple algorithm about the chessboard coverage problem can be
designed by the divide-and-conquer strategy. When k > 0, divide the
chessboard of 2k×2k into 4 sub-chessboards of 2k-1×2k-1
The special pane must be located in the small one of four sub-
chessboards, and other three sub-chessboards have no special panes.
To convert these three sub-chessboards into the special chessboard,
one L-type triomino can be put on the junction of three smaller
chessboards .
The pane which is covered by the L-type triomino on three sub-
chessboards is the special pane on this chessboard, so the original
problem is converted into four smaller chessboard coverage
problems.
Recursively use this division until the chessboard is simplified as the
chessboard of 1×1.
12 Defective Chessboard
Tiling: Divide-and-Conquer
Tiling is a divide-and-conquer algorithm:
1. Just do it trivially if the board is 2x2, else:
2. Divide the board into four smaller boards (introduce holes at
the corners of the three smaller boards to make them look like
original problems)
3. Conquer using the same algorithm recursively
4. Combine by placing a single triomino in the center to cover the
three introduced holes
13 Defective Chessboard
Tiling A Defective Chessboard
Divide into four smaller chessboards. 4 x 4
One of these is a defective 4 x 4 chessboard.
14 Defective Chessboard
Tiling A Defective Chessboard
Make the other three 4 x 4 chessboards defective by placing a
triomino at their common corner.
Recursively tile the four defective 4 x 4 chessboards.
15 Defective Chessboard
Divide and Conquer : recursive algorithm.
// n is size of given square, p is location of missing cell
1. Tile(int n, Point p)
2. Base case: n = 2, A 2 × 2 square with one cell missing is nothing but
a tile and can be filled with a single tile(Triomino).
3. Place a L shaped tile(Triomino) at the center such that it does not
cover the n/2 × n/2 subsquare that has a missing square. Now all
four subsquares of size n/2 × n/2 have a missing cell (a cell
that doesn't need to be filled).
4. Solve the problem recursively for following four. Let p1, p2, p3 and
p4 be positions of the 4 missing cells in 4 squares. a) Tile(n/2, p1)
b) Tile(n/2, p2) c) Tile(n/2, p3) d) Tile(n/2, p3)
16 Defective Chessboard
After placing first tile
Place a triomino at the center so that it fully covers one square from
each of the three ( 3 ) subboards with no missing square, and misses the
fourth subboard completely.
17 Defective Chessboard
Recurring for first subsquare.
18 Defective Chessboard
Shows first step in all four subsquares.
19 Defective Chessboard
Exercise: Algorithms Horowitz, Sahni & Rajasekaran : page 145
20 Defective Chessboard
Algorithm TileBoard
1. Algorithm TileBoard(toprow, topcol, defectrow, defectcol,size)
2. // toprow is row number of top-left corner of board
3. // topcol is column number of top-left cornor of board
4. // defectrow is row number of defective square.
5. // defectcol is column number of defective square.
6. // size is length of one side of chess board
7. {
8. If(size = 1) return;
9. Tiletouse := tile ++;
10. Quadrantsize := size/2;
11. // tile top-left quadrant
12. If (defectrow < toprow + quadrantsize &&
13. Defectcol < topcol + quadrantsize) then
14. // defect is in this quadrant
15. TileBoard (toprow, topcol, defectrow, defectcol, quadrantsize);
16. else
21 Defective Chessboard
Algorithm: TileBoard
17. {
18. // no defect in this quadrant
19. // place a tile in bottom-right cornor
20. Board[toprow + quadrantsize -1][topcol + quadrantsize -1] :=
tiletouse;
21. //Tile the rest
22. TileBoard(toprow, topcol, toprow + quadrantsize -1, topcol +
quadrantsize -1, quadrantsize );
23. }
24. // Code for remaining three quadrant is similar
25. }
22 Defective Chessboard
C program : ChessBoard #1/2
1. void ChessBoard(int tr, int tc, int dr, int dc, int size)
2. {
3. if(size==1) return;
4. int t=tile++, s=size/2;
5. // cover the sub-chessboard of the top left corner
6. if(dr<tr+s && dc<tc+s)
7. ChessBoard(tr, tc, dr, dc, s);
8. else{Board[tr+s-1][tc+s-1]=t;
9. ChessBoard(tr, tc, tr+s-1, tc+s-1, s); }
10. // cover the sub-chessboard of the top right corner
11. if(dr<tr+s && dc>=tc+s)
12. ChessBoard(tr, tc+s, dr, dc, s);
13. else{Board[tr+s-1][tc+s]=t;
14. ChessBoard(tr, tc+s, tr+s-1, tc+s, s); }
23 Defective Chessboard
C program : ChessBoard #2/2
15. // cover the sub-chessboard of the down left corner
16. if(dr>=tr+s && dc<tc+s)
17. ChessBoard(tr+s, tc, dr, dc, s);
18. else{Board[tr+s][tc+s-1]=t;
19. ChessBoard(tr+s, tc, tr+s, tc+s-1, s); }
20. // cover the sub-chessboard of the down right corner
21. if(dr>=tr+s && dc>=tc+s)
22. ChessBoard(tr+s, tc+s, dr, dc, s);
23. else{Board[tr+s][tc+s]=t;
24. ChessBoard(tr+s, tc+s, tr+s, tc+s, s); }
25. }
24 Defective Chessboard
In above algorithm, a two-dimensional integer array Board is used to
denote the chessboard. Board[0][0] is the pane of top left corner of
the chessboard.
Tile is a comprehensive integer variable in the algorithm and it is used
to denote the number of the L-type domino, and its initial value is 0.
And the input parameters of the algorithm include
tr (the row number of the pane of top left corner of the
chessboard),
tc (the column number of the pane of top left corner of the
chessboard),
dr (the row number of the special pane),
dc (the column number of the special pane),
size (size=2k, and it denotes that the specification of chessboard is
2k×2k).
25 Defective Chessboard
A 4×4 Chessboard
26 Defective Chessboard
27 Defective Chessboard
Chessboard converge results
28 Defective Chessboard
Chessboard Coverage Sequence
29 Defective Chessboard
Complexity
Let n = 2k.
Let t(k) be the time taken to tile a 2k x 2k defective chessboard.
t(0) = d, where d is a constant.
t(k) = 4t(k-1) + c, when k > 0. Here c is a constant.
Recurrence equation for time complexity t().
t(0) = d, when k=0; here d is a constant.
t(k) = 4t(k-1) + c, when k > 0; here c is a constant.
30 Defective Chessboard
Substitution Method
t(k) = 4t(k-1) + c
= 4[4t(k-2) + c] + c
= 42 t(k-2) + 4c + c
= 42[4t(k-3) + c] + 4c + c
= 43 t(k-3) + 42c + 4c + c
=…
= 4k t(0) + 4k-1c + 4k-2c + ... + 42c + 4c + c
= 4k d + 4k-1c + 4k-2c + ... + 42c + 4c + c
= (4k)
= (number of triominoes placed)
Since we must spend at least (1) time placing each tile, we cannot obtain
an asymptotically faster algorithm than divide and conquer.
Because the amount of L-type domino to cover one chessboard of 2k×2k is
(4k-1)/3, the algorithm of TileBoard is the optimal algorithm on the
asymptotic meaning.
31 Defective Chessboard
Conclusion
Three approaches of the divide-and-conquer algorithm to solve the
chessboard coverage problem are an organic integer, and the division of the
original problem into many sub-problems is the key content, and it is the
key approach to solve problem by the divide-and-conquer algorithm.
The present divide-and-conquer method uses program skill to solve the
problem of chessboard coverage, and splits the L-type dominos and cover,
which is not consistent with the former analysis, and adds difficulties for
the divide-and-conquer algorithm which is not complex originally, and the
teaching effect is not ideal.
The divide-and-conquer method contains abundant mathematical ideas
which should be dug and studied in the teaching to ensure the continuity
and consistence of students’ thinking development and enhance the
learning effect.
Therefore, aiming at the problem of chessboard coverage, the coverage
sequence of L-type dominos in the flow of the divide-and-conquer
algorithm is improved, and the improved algorithm can not only eliminate
the algorithm skill, but add the standardization and consistence of the
algorithm and achieve better teaching effect
32 Defective Chessboard
Thanks for Your Attention!
33 Defective Chessboard
Exercises
1. A rectangular floor measuring 'm' feet by 'n' feet is tiled with one-
foot square tiles. How many tiles would the diagonal of the
rectangle cross?
2. How many square boxes are crossed by a diagonal in a rectangular
table formed by 199*991 identical squares?
3. Give the problem definition of a defective chessboard? Explain
clearly how divide and conquer method is used to find the solution.
4. Consider an m × n rectangular chessboard. Suppose we want to tile
this board with dominoes, where a domino is a 2 × 1 rectangle, and
a tiling is a way to place several dominoes on the board so that all of
its squares are covered but no dominos overlap or lie partially off
the board. Is such a tiling possible? If so, how many are there?
34 Defective Chessboard
More problems …
1. Measurements: How many orange ping pong balls fit into a square
meter box?
2. Why is the shape of books rectangular and not square?
3. Is it possible to install a square or rectangular manhole?
4. In a closed rectangular box with square ends, the total surface
area is 216cm2. What are the dimensions that will give the
greatest volume?
5. How many small squares can fit into this big square?
6. Why are manholes circular in shape not rectangular or square?
7. Why are the houses mostly square or rectangular in shape?
8. How many rectangles can be made out of a 3×3 box of squares?
Measurements: How many square meters are in a square foot?
35 Defective Chessboard