Question: It is an experiment where you need to compute execution time of linear search and binary search for different sizes of arrays and compare the
It is an experiment where you need to compute execution time of linear search and binary search for different sizes of arrays and compare the results by ploting on excel/google sheet. Write a report analyzing the output.
1. Sample code for generating random array and getting execution time is given.
2. Compute execution time for different sizes of arrays.
3. Plot the execution time for linear search and binary search on MS excel/google sheet.
4. Include the plot with the report.
Whats in the report?
1. The configuration of your computer. (OS:? Ram:? Processor:?)
2. The execution time plot.
3. Analysis on which algorithm is better according to execution time and why?
import java.util.Random; import java.util.Arrays; public class Lab6 { public static void main(String args[]) { int[] n= {2500, 5000, 10000, 20000, 40000}; for(int i=0; i= max) { throw new IllegalArgumentException("max must be greater than min"); } Random r = new Random(); return r.nextInt((max - min) + 1) + min; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
