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

  Explain sorting algorithm which is optimal in cost

Explain a sorting algorithm which is optimal with respect to this cost model and uses O(n) space. That is, time used by algorithm should exactly match lower bound

  Describe ways to generalize a simple sorting algorithm

Describe ways to generalize a simple sorting algorithm (such as insertion sort, or any other sort you are familiar with) to support this generalization

  Show state of memory after processes by best fit algorithm

Using the best fit algorithm, show the state of memory after processes of 212K, 417K, 112K and 350K (in request order) arrive.

  System analyst

A huge, well regarded supplier of key raw materials to your corporation's production process requires a year-end summary report of totals purchased from it.

  C program that accepts a month and day

Make a C program that accepts a month and day for example, June 14 from the keyboard as input. Store this data in a string called date.

  Algorithm for a bank account

Write algorithm to settle following question: A bank account starts out with $10,000. Interest is compounded monthly at 6 percent per year (0.5 percent per month).

  Currency conversion development

Currency Conversion Development

  Evaluate each of the following statements

If x = 5, y = 6, z = 4, and w = 3.5, evaluate each of the following statements, if possible. If it is not possible, state the reason.

  Shell scripting based questions

Determine will the following only print the text "I FOUND A MATCH" to standard output when the grep is successful? if grep "mrichard" /etc/passwd; then echo "I FOUND A MATCH"; fi

  Er modeling

A supplier supplies certain number parts for a assignment, a assignment uses the parts from the different suppliers, and the same kind parts from different suppliers are used by different assignments.

  Method singleparent returns number of nodes in binary tree

Write a method singleParent, which returns number of nodes in a binary tree that have only one child.

  Differences between the structured design methodology

differences between the structured design methodology

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