Question: Sorting/searching arrays 1. Write a C++ program that will create an array of 50 integers (you are not allowed to use vectors). 2. Using the
Sorting/searching arrays
1. Write a C++ program that will create an array of 50 integers (you are not allowed to use vectors). 2. Using the rand function to generate random numbers between 1 and another number specified by the user (prompt the user for this value). 2. The program must output the array of random integers with a function named displayList. 3. Have the program sort the array of random integers from largest to smallest ( current discussion on sorting has sorting algorithms sort from smallest to largest, how do we do the opposite? ). Use either bubble sort ( if you really feel up for the out-side-the-box-thinking challenge, try heap sort - this is normally taught in data structures - 1 point extra credit for using merge sort or heap sort [ pseudocode located in the How To Folder ] ). 4. The program must output the sorted array of random integers again with a function named displayList. 5. Prompt the user to enter a value to search for by using Binary Search ( this value may or may not be in the list of random values generated ). 6. Output whether or not Binary Search found the search value and output the index of where the value was located, if it was found, otherwise output that it was not found. Make sure to use the input validation techniques we have discussed and used (kitty cat proof input).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
