Question: 9A: Plotting Run Time for Binary Search Write a method which uses binary search algorithm to check if a value is in an array or

 9A: Plotting Run Time for Binary Search Write a method which

9A: Plotting Run Time for Binary Search Write a method which uses binary search algorithm to check if a value is in an array or not. Return true if in the array, false if not. Also write a test program to record the time it takes to search arrays with different size (test to find optimal size for plotting). More specifically, in main method, create arrays in different size and initialize the array with random numbers, then call the method to search in each of those arrays. Output the time it takes for searching each array Once you got the time along with the size of the array, copy them to an Excel worksheet, plot a graph to show the time complexity. Letx-axis be the size and y-axis be the time. If the size and time unit are chosen appropriately, you should be able to get a graph in log n shape. Submission 1. The java program (if it's multiple files, zip them) 2. The excel worksheet with graph

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!