Question
Sorting technique on an array of 20 numbers. The program should print out the contents of the vector after each pass of the array is
Sorting technique on an array of 20 numbers. The program should print out the contents of the vector after each pass of the array is made. This way the "selection" process can be observed. Your data output (i.e. the contents of your array after each pass) should look as follows: Data: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Pass 1: 1 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 Pass 2: 1 2 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 To make it simpler, just write the data to a file and have your program read the numbers from the file into an array before it calls the sort () method. Be sure to implement the program as a set of functions: main () to initialize the array, print () to print out the contents of the array, and sort()to sort its contents. There are arguments to the methods that you will have to declare in order to pass an array between methods.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started