Question: A peak element of an array of n elements is an element at a position i such that a[i - 1]
A peak element of an array of n elements is an element at a position i such that a[i - 1] <= a[i] and a[i + 1] <= a[i]. It is possible that the first element or the last element of an array is a peak. An array may have several peaks.
write and test thoroughly a template function that returns the position of a peak element in an array of n elements. The function's prototype is
tempate
Type peak(Type a[], size_t size);
*NOTE: I need help to write out this problem in C++ while using Visual Studio 2017
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
