Question: We are given a checkerboard which has 4 rows and n columns, and has an integer C[i, j] written in each square, where i

We are given a checkerboard which has 4 rows and n columns, 

We are given a checkerboard which has 4 rows and n columns, and has an integer C[i, j] written in each square, where i [4] and j = [n]; We are also given a set of 2n pebbles, and we want to place some or all of these on the checkerboard (each pebble can be placed on exactly one square) so as to maximize the sum of the integers in the squares that are covered by pebbles. There is one constraint: for a placement of pebbles to be legal, no two of them can be on horizontally or vertically adjacent squares (diagonal adjacency is fine). (a) Determine the number of legal patterns that can occur in any column (in isola- tion, ignoring the pebbles in adjacent columns) and describe these patterns. (You can draw pictures.) Call two patterns compatible if they can be placed on adjacent columns to form a legal placement. Let us consider subproblems consisting of the first k columns 1 < k < n. Each subproblem can be assigned a type, which is the pattern occurring in the last column. (b) Using the notions of compatibility and type, give an O(n)-time dynamic pro- gramming algorithm for computing an optimal placement.

Step by Step Solution

3.42 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Determine the number of legal patterns in any column and describe these patterns In each column there are 4 rows To satisfy the adjacency constraint ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!