Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (Dynamic Programming - 20 points) You are given a checkerboard with 4 rows and n columns with an integer written in each square. You

image text in transcribed
3. (Dynamic Programming - 20 points) You are given a checkerboard with 4 rows and n columns with an integer written in each square. You are also given 2n pieces of paper, such that each piece of paper covers exactly one square. You need to place some or all of these pieces of paper on the checkerboard (at most one piece per square) so as to maximize the sum of integers covered by the pieces of paper. However, in order for your placement to be legal, no two pieces of paper can be placed on horizontally or vertically adjacent squares (diagonal adjacency is allowed). Design an efficient dynamic programming algorithm to compute the optimal value to this problem. (a) (2 points) Describe this problem formally in the Input: ..., Output: ... format. (b) (3 points) Find out the number of legal patterns of pieces of paper that can occur in any column (in isolation, ignoring the neighboring columns). Describe these patterns. (c) (2 points) Two patterns from the previous part are compatible if they can be placed on adjacent columns to form a legal placement. Give one example of compatible patterns. Give one example of non-compatible patterns. (d) (4 pts) Consider subproblems consisting of the first i columns with 1 Sisn. Each subproblem can be assigned a type which is the pattern occurring in the last column. Based on this, describe the semantic array. State what the answer to the whole problem is based on your array. (e) (4 pts) Describe the computational array. Do not forget the base case. (f) (4 pts) Describe your algorithm in pseudocode. (g) (1 pt) What is the runtime of your algorithm? Why

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions