Chess board problem(divide and conquer)

15,764 views 15 slides Dec 21, 2019
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

This PPT contains a divide and conquer chessboard problem solution and its algorithm.


Slide Content

DIVIDE AND CONQUER ALGORITHM

CHESS BOARD PROBLEM- DIVIDE AND CONQUER

The Defective Chessboard Problem GIVEN CONDITIONS:- We have a chessboard of size n x n , where n =2 k Exactly on square is defective in the chessboard. The tiles(trominoes) are in L-shape i.e. 3 squares. OBJECTIVE Cover all the chessboard with L-shape tiles(trominoes), except the defective square.

Is it possible to solve this? Absolutely, it is possible to cover all non-defective squares. Let’s see how As the size of the chessboard is n x n and n=2 k Therefore, Total no. of squares =2 k x2 k =2 2k No. of non-defective squares = 2 2k -1 Now, for the value of K,2 2k -1 is divisible by 3. For E.g. K=1 , 2 2(1) -1 =3 is divisible by 3. K=2, 2 2(2) -1 =15 is divisible by 3.

Defective chessboards. 1x1 2 x2 2 x2 2 x2 2 x2 As the Size of these chessboards displayed here, 1x1 and 2x2 we don’t have to place any L-shape tile in the first and rest can be filled by just using 1 L-shaped tile.

For 4x 4 chessboard.

8X8 DEFECTIVE CHESS BOARD Step-1 One of the cell is defective Step- 2 We divide the chess board into equal sub half's.

Creation of defective box Step- 3 Trick to cover the chess board with tiles Step -4 Again creation of defective boxes as we divide the chess board DIVISION OF PROBLEM INTO SUB PROBLEM

Step-5 As we have finally divided the problem into 2x2 board we will put the tiles. Step-6 The procedure will continue until all the sub board are covered with the tiles.

Step-7 The final chess board covered with all the titles and only left with the defectives which we created. Step-7 Here we will cover the defectives which we have created as in the last, there should be only one defective left. COMBINIG OF ALL SUB PROBLEMS

8x8 4x4 4x4 4x4 4x4

2x2 2x2 2x2 4x4 2x2

1x1 2x2 4x4 8x8

ALGORITHIM 1. For a 2x2 board with defective cell we just need to add the single tile to it. 2. We will place a L shape tile in the middle such that it does not cover the sub square in which there is already defective. All the cell have a defective cell. 3.Repeat this process recursively till we have a 2x2 board.

Time Complexity For Defective Chess Board Problem T(n) =4T(n/2) +C By Using Master Theorem, T(n) =a T(n/b) + Theta(n k log p n ),a>=1,b>1,k>=0 & p is real number. a=4,b=2,k=0,p=0 a>b k => 4 >2 Case1: If a>b k , then T(n) =Theta( n log b a ). After putting the values of a and b the Time complexity for this problem = n 2 .