Question: Given an array of integers. Find a mountain top element in it. An array element is moutain top element if it is NOT smaller than
Given an array of integers. Find a mountain top element in it. An array element is moutain top element if it is NOT smaller than its neighbors.ie if an element is greater than its left and right element. For corner elements, we need to consider only one neighbor. For example, for input array {5, 10, 20, 15}, 20 is the only peak element. For input array {10, 25, 15, 7, 36, 75, 53}, there are two mountain top elements: 25 and 75. Note that we need to return any one of the mountain top element .
Following corner cases give better idea about the problem.
If input array is sorted in strictly increasing order, the last element is always a mountain top element. For example, 50 is mountain top element in {10, 20, 30, 40, 50}.
If input array is sorted in strictly decreasing order, the first element is always a mountain top element. 100 is the mountain top element in {100, 80, 60, 50, 20}.
If all elements of input array are same, every element is a mountain top element. So return an element
Your input should have arrays, of each test case described above and should output the value for each of the test case.
This question is based on Inheritance: -
Create a class Book with the following members: Accession number, Name of the author, Title of the book, Year of Publication, Publishers Name, Cost of the book and Availability
Create a class Membership with the following members: Member id, Name, Maxbooks Derive a class Library information_system from Book and Member. Include the following member functions:
1. Issue a book after checking member id, book id, Availability of the book and Maxbooks available for the member.
2. Update availability of book and Maxbooks after each transaction.
3. Display a members information given member id
-Should paste the screen shot of your input and output.
-Should post 2-3 sentences of approach on problem
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
