Question: (35 point) Given two 2D array of 0 with size N*N. There are some positions in the matrix that have value of These values of
- (35 point) Given two 2D array of 0 with size N*N. There are some positions in the matrix that have value of These values of 1 will create objects. Check which object has bigger Area (not circumference). If it has the same size print: object 1 and 2 has the same size
For example:
Input:
Matrix 1
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 |
Matrix 2
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 |
Output: object 2 is bigger
Input:
Matrix 1
| 0 | 1 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 |
Matrix 2
| 0 | 1 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 |
Output: object 1 and 2 has the same size
Use C languange with
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
