Sample Output: How large should the array be? 10 What should be the highest number in the sequence? 6 5, 2, 2, 2, 3, ө, 1, 6, 2, 1, [Options] 1) Reset the array 2) Sort (Smallest to Largest) 3) Sort...


C++ please.


Sample Output:<br>How large should the array be? 10<br>What should be the highest number in the sequence? 6<br>5, 2, 2, 2, 3, ө, 1, 6, 2, 1,<br>[Options]<br>1) Reset the array<br>2) Sort (Smallest to Largest)<br>3) Sort (Largest to Smallest)<br>4) Quit<br>Choice? 2<br>Using Insertion Sort:<br>0, 1, 1, 2, 2, 2, 2, 3, 5, 6,<br>[Options]<br>1) Reset the array<br>2) Sort (Smallest to Largest)<br>3) Sort (Largest to Smallest)<br>4) Quit<br>choice? 3<br>Using Selection Sort:<br>6, 5, 3, 2, 2, 2, 2, 1, 1, о,<br>

Extracted text: Sample Output: How large should the array be? 10 What should be the highest number in the sequence? 6 5, 2, 2, 2, 3, ө, 1, 6, 2, 1, [Options] 1) Reset the array 2) Sort (Smallest to Largest) 3) Sort (Largest to Smallest) 4) Quit Choice? 2 Using Insertion Sort: 0, 1, 1, 2, 2, 2, 2, 3, 5, 6, [Options] 1) Reset the array 2) Sort (Smallest to Largest) 3) Sort (Largest to Smallest) 4) Quit choice? 3 Using Selection Sort: 6, 5, 3, 2, 2, 2, 2, 1, 1, о,
Assignment 6B: Forwards and Backwards. Up to this point, we have sorted array values from<br>smallest to largest. However, there are times when we need to do the reverse and sort from<br>largest to smallest. We will implement a way to do this using Insertion Sort and Selection Sort.<br>Take in an initial array size value from the user (C++ students: Check the Appendix for more<br>information on how to do this) and a value for the highest possible value in the sequence. Fill<br>the array with random values between 0 and that highest value. Then provide the user with the<br>following options:<br>• Change the array's elements with new random values<br>• Use the numbers entered by the user initially for this; do not prompt the user for new<br>numbers<br>Sort from smallest to largest<br>• Use Insertion Sort to sort the array so that the smallest value is at index 0, and the<br>largest value is at the end of the array.<br>• Sort from largest to smallest<br>o Use Selection Sort to sort the array so that the largest value is at index 0, and the<br>smallest value is at the end of the array.<br>• Quit to end the program<br>After an option is picked (except for Quit), print the array out and provide the choices to the user<br>once again. The sample output shows the format of your program's output – however, the values<br>will be different since the numbers are generated randomly.<br>

Extracted text: Assignment 6B: Forwards and Backwards. Up to this point, we have sorted array values from smallest to largest. However, there are times when we need to do the reverse and sort from largest to smallest. We will implement a way to do this using Insertion Sort and Selection Sort. Take in an initial array size value from the user (C++ students: Check the Appendix for more information on how to do this) and a value for the highest possible value in the sequence. Fill the array with random values between 0 and that highest value. Then provide the user with the following options: • Change the array's elements with new random values • Use the numbers entered by the user initially for this; do not prompt the user for new numbers Sort from smallest to largest • Use Insertion Sort to sort the array so that the smallest value is at index 0, and the largest value is at the end of the array. • Sort from largest to smallest o Use Selection Sort to sort the array so that the largest value is at index 0, and the smallest value is at the end of the array. • Quit to end the program After an option is picked (except for Quit), print the array out and provide the choices to the user once again. The sample output shows the format of your program's output – however, the values will be different since the numbers are generated randomly.
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here