Question: Array search using Algorithms. (Please help me!) Suppose an array of n elements. These elements are in increasing order until the highest value and then

Array search using Algorithms. (Please help me!)

Suppose an array of n elements. These elements are in increasing order until the highest value and then in decreasing order until the end of the array.Describe an algorithm which will find the highest value in time O (logn). The Java program you will write will create an Array with 10000 items. The type of the Array will be an Array of ints. After creating the array, your program will fill the array with random integers and then implement the algorithm you described. In particular: -implement a method RandomPosition(int MAX) which will choose randomly a number "k" from 1 to 10000. MAX is the array length. -implement a method RandomUnique(int k) which will fill the array with random unique numbers (from 1 to 100000), starting from its 1st element till the element in position k in increasing order, and from the element in position k+1 till the end of the array in decreasing order. (Every element in the array must be unique) -implement a method findMaximum which will find the position of the highest value of the array using the algorithm you described. -create a main method to implement the above algorithm.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!