an array of 1200 elements. Use a random number generator to fill list by using a sorting algorithm to sort list and search list for the binary search algorithm to search list. Use the sequential search algorithm to search list and print the number of comparisons. If the item is found in the list, print its position. Use the given c
Java: Write a program to find the number of comparison using sequentialSearch and binarySearch algorithms using an array of 1200 elements. Use a random number generator to fill list by using a sorting
Use the given code:
import java.util.*;
public class Problem{
static Scanner console = new Scanner(System.in);
final static int SIZE = 1000;
public static void main(String[] args){
Integer[] intList = new Integer[SIZE];
SearchSortAlgorithms<Integer> intSearchObject = new SearchSortAlgorithms<Integer>();
Random rand=new Random();
int numOfComparisions=0;
for(int i=0;i<1000;i++)
intList[SIZE]=rand.nextInt(1000)+1;
}
}
Step by step
Solved in 2 steps with 1 images