Write a program to find the number of comparisons using


Write a program to find the number of comparisons using binarySearchand the sequential search algorithm as asked below. Suppose list is an array of 1000 elements:

3.1. Use a random number generator to fill list.

3.2. Use bubble sort algorithm to sort the list.

3.3. Search the list for some items as follows:

3.3.1. Use the binary search algorithm to search the list.

3.3.2. Use the binary search algorithm to search the list, switching to a sequential search when the size of the search list reduces to less than 15. 3.4.

Print the number of comparisons for question 3.3.1 and 3.3.2. If the item is found in the list then print its position.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program to find the number of comparisons using
Reference No:- TGS01563974

Expected delivery within 24 Hours