Write a function to find a superpeak element in an array a


Question :

Write a function to find a superpeak element in an array. A superpeak element is an element that is greater than the sum of its neighbors.

Given an input array where numali find a super peak element and return its index. The array may contain multiple superpeaks, in that case return the index to any one of the superpeaks. he array may not contain any superpeaks, in that case return -1.

You may assume that numl-1) o and numln m 0. So, numjol and numin -1) could be superpeaks as well.

For example, in array 1, 2, 4, 1), 4 is a super peak element and your function should return its index 2. he array (1 2, 3, 2) does not have any superpeaks and you should return -1. In below function prototype, n is the size of the array int superpeak (int num int n)

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a function to find a superpeak element in an array a
Reference No:- TGS02893395

Expected delivery within 24 Hours