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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started