Question: We have an n m rectangle / array M . Each cell in M has a arbitrary value in the range of [ 1 ,
We have an n m rectanglearray M Each cell in M has a arbitrary value in the range of n m We want to cut M into several pieces of rectangles such that all the grid cells in a single rectangle have the same value. A rectangle can be cut only along one of its horizontal or vertical grid lines, which will break it into two rectangles. Note that you can only cut one rectangle at a time. And the price of cutting the rectangle is the area of the rectangle aka the number of grid cells in it Clearly the worst case is to cut M into n m pieces. But we want to find if there is any better solution. Describe an algorithm that computes the minimum cost of cutting the input grid M into pieces, following the above rules, so that the if two grid cells is on the same board, they must have the same value. Your algorithm should be as fast as possible.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
