Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago