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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started