Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions