Question: Tasks: 1. Write a C program, problem1.c, with at least one more function than the main function to print the number of peaks and their

 Tasks: 1. Write a C program, problem1.c, with at least one

Tasks: 1. Write a C program, problem1.c, with at least one more function than the main function to print the number of peaks and their locations in an elevation grid. A peak is defined to be a location at which the north, south, east, and west neighbors have lower values than the peak. If a location does not have all four neighbors, then it cannot be a peak. a. Declare and initialize the elevation grid as a 2-dimensional array with the following data. In the grid, locations (2,1), (2,5), and (4,3) are peaks. I. 5039 5127 5238 5259 5248 5310 5299 ii. 5150 5392 5410 5401 5320 5820 5321 iii. 5290 5560 5490 5421 5530 5831 5210 iv. 5110 5429 5430 5411 5459 5630 5319 v. 4920 5129 4921 5821 4722 4921 5129 vi. 5023 5129 4822 4872 4794 4862 4245 b. Use define macro constants for the number of rows and columns in the grid so that the grid size is not hard coded throughout the program. c. Example output: i. 3 peaks found: ii. Location at row 2 and column 1 iii. Location at row 2 and column 5 iv. Location at row 4 and column 3 d. In comments at the end of the program, note i. the output for the program ii. for an mxn elevation grid, the Big-O storage complexity required to store the data, the number of peaks, and the peak locations (think carefully about how big the peaks storage needs to be) iii. for an mxn elevation grid, the Big-O time complexity required to process the elevation grid to find the peaks, and print the peaks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!