Determine the number of peaks and valleys in given terrain

Assignment Help Data Structure & Algorithms
Reference no: EM13893590

Elevation in 2D arrays (C++)

DATA FILE: https://pastebin.com/DTQ9kenP Goals: Using 2-dimensional arrays.

Problem: Navigation over a terrain can be an important concept. Usually you want to avoid high areas (peaks) and low areas (valleys). For this problem, you may assume the terrain that you want to navigate over may be represented as a 2-dimensional grid of cells. You are to determine the number of peaks and valleys in this terrain as well as give the location of these peaks and valley. A peak is defined as a cell for which all eight neighbors are lower than the cell being considered.

A valley is defined as a cell for which all eight neighbors are higher than the cell being considered. An example grid is given below with some of the peaks in bold and some of the valleys underlined. Note that no cell on the perimeter may be considered a peak or valley. Use a function to input the values from the file (remember the first line in the file contains the number of rows and columns respectively). Use a function to locate peaks and valleys and store the locations (row and column indices) of these peaks and valleys.

Use a function to calculate the average elevation over the entire grid and determine the maximum gradient. The gradient is the absolute difference between two adjacent cells. For example in the array given below, the cell containing 43 (row 2 and column 3) would have adjacent cell containing the values 63, 45, 38 and 40.

Design your code so you do not compare the same two cells more than once. Use a function to output the number of peaks or valleys and elevations associated with the peak or valley and the locations of these peaks or valleys (this file will be called twice from main).

Create an output file containing number of peaks, number of valleys, and locations ([row, column]) of these peaks and valleys, the average height, and maximum gradient.

Your main function should Declare the 2-Dimensional array (no input file will contain more than 100 rows and 100 columns).

Call the function to import the data

Call the function to locate the peaks, valleys, and locations of the peaks and valleys.

Call the function to calculate the average and maximum gradient.

Call the function to output peaks or valleys and locations with peak information.

Call the function to output peaks or valleys and locations with valley information.

Call the function to determine the overall elevation average and maximum gradient and output these.

Reference no: EM13893590

Questions Cloud

Which beaker contain a solution that is hypertonic to bag : Arrange the beakers above in order of the mass of the bags inside them after the experiment has run for 30 minutes. List the bag that loses the most mass first.
Discuss pros and cons of using perpetuity in real estate : Discuss the pros and cons of using perpetuity in real estate valuations and what are the main components of sustainability -  what are the main objectives of the research paper?
What are main arguments for and against psychodiagnosis : What are main arguments for and against psychodiagnosis? What is your position on this topic? Corey (2014) highlights that research, in addition to theory, can inform ethical practice
Number of jobs and levels of jobs : The recent recession had a significant impact on many people's careers. Current indications are that it may take a few more years to get job levels back to past levels, both in number of jobs and levels of jobs:
Determine the number of peaks and valleys in given terrain : Problem: Navigation over a terrain can be an important concept. Usually you want to avoid high areas (peaks) and low areas (valleys) -
What can you do about overt and covert resistance? : What can you do about overt and covert resistance?
Paper - generlized anxiety disorder : 5 pages. Single spaced. Times New Roman On topic of your choosing related to learning and memory. Must have 3 primary source articles. Generally, use www.pubmed.gov to find article abstracts. The topic is Generlized Anxiety Disorder
Explain the spiral approach : Please explain the spiral approach and how it is incorporated into my career path.
How come my elution washes didnt resolve in the gel : How come my elution washes didnt resolve in the gel of my SDS-Page? How come my his-tagged protein and protein were the only two things that resolved in my western blot membrane? (If you could also tell me why my cell lysate and other samples didnt ..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Question about oracle9i database

Provide every worker in the Local Locale Company the privileges required to query and update the NEWS_ARTICLE table and the CLASSIFIED_AD table.

  Linked lists give a program to implement the insert

give a program to implement the insert operation and delete operations on a queue using linked

  An algorithm that will sort a with a worst-case runtime

Let A be an array with n elements such that the first n -sqrt( n) elements are already sorted (though we know nothing about the remaining elements). Give an algorithm that will sort A with a worst-case runtime substantially better than O(n logn).

  Develop an online shopping system for the stakeholders

Online shopping becomes increasing popular nowadays. It brings many advantages to both sellers and buyers. Metro Shopping (MS) is planning to develop an online shopping system for the stakeholders.

  Creating entity-relationship model

The manager for the Clearwater Traders wishes to collect the following information for each order placed by a consumer: consumer's name and address, item's size or color if applicable and the retail price of each item.

  Astronaut.data must be read into a 1-d array

Data from the Astronaut.data must be read into a 1-D array of structures(or classes) named ASTRONAUT and thereafter all processing must be performed on the array of structures.

  What is the data type

What is the data type and What is the type of the parameter

  Js code to prompt the user for integer and print result

Write JS code which prompt the user for an integer and prints the result.

  Adt description

Which of the following is not the part of ADT description? Which of the following is true about the characteristics of abstract data types

  Implementing the banker algorithm

Prompt user to enter the size of matrix n and m. Your program should accept any n x m matrix and m vectors where n and m are positive integer less than ten.

  Data-hiding techniques

Suppose you are the Chief Security Officer for a financial institution. Someone on your information security staff has informed you that recent Web content filters have shown an end user who has been visiting sites dedicated to alternate data stre..

  Explain spacewise efficient implementation two-stack data

Structure of such two-stack data type would consist of two arrays and two top pointers. Describe why this may not be a spacewise efficient implementation.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd