Question: Write an application that determines the performance of a sort algorithm for integers based on counting the number of comparisons. Create an array of 500

Write an application that determines the performance of a sort algorithm for integers based on counting the number of comparisons.

Create an array of 500 random integers using the Random class. Next sort this array of integers using Quick Sort and save the result in a new array.

Create a DemoProgram that will pick a random integer from the above array and run a sequential search on the unsorted array and a binary search on the sorted array to find this integer. Keep track of the number of comparisons for each sort.

Do the above 10 times, printing out the comparisons each time and then printing out the average number of comparisons overall for each search algorithm.

Please make sure you comment your code thoroughly.

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!