In class we developed three methods for sorting data (bubble, selection, insertion) and two methods for searching data (linear, binary). When we developed the insertion sort in class, we used a linear type search to determine where the new value to be inserted in the vector should be placed.

Modify the insertion sort to use a binary type search to locate where the new value should be inserted in the vector.

Write a program that will prompt the user to enter the number of values to sort. Your program will populate a vector with that many random values. Copy that data into 2 other vectors so that you have 3 identical vectors.

Sort the first vector using a bubble sort and the second using a selection sort. Using the third vector as the list of values to input, populate a vector using the insertion sort with linear search and another using the binary search.

Using the time() function, display how long it takes to sort the data using the 4 methods.

Run this program several times using the following quantities for the input:

100
1,000
5,000
10,000
50,000
100,000 optional depending on how long the run takes.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.