Question: Write a divide-and-conquer algorithm to solve this following problem. The input will consist of three numbers: n (the side length of the square land to
Write a divide-and-conquer algorithm to solve this following problem. The input will consist of three numbers: n (the side length of the square land to divide, always a power of 2), r and c (the coordinates of wetlands square, each in the range 0 . . . n 1). Given this, you should output the grid with numbers indicating which squares are included in each of the 3-parcel tracts of land. One possible output for the above example might be:
| 2 | -1 | 4 | 4 |
| 2 | 2 | 1 | 4 |
| 3 | 1 | 1 | 5 |
| 3 | 3 | 5 | 5 |
PROGRAM HINT: Divide the parcel into 4 even size sections and determine which section the wetlands square is, i.e. a square that should not be used. Then place a 3-parcel piece on the grid in an appropriate way to allow for recursive calls
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
