Question: Recursion and Sorting Read all numbers from the text file and save them into an array Create two functions getMin() and getMax(). These functions should

Recursion and Sorting

Read all numbers from the text file and save them into an array Create two functions getMin() and getMax(). These functions should accept at the least, an array and its size. From there, the function should calculate the min/max value contained within that array, and return a pointer to the address containing it. getMin(): will return a pointer to the minimum value of the array. getMax(): will return a pointer to the maximum value of the array. Sorting the array: You are NOT allowed to use any standard sorting algorithms, you must implement. normalSort(): This function will sort an array in a given order (ascending or descending depending on an argument passed in) by applying the getMin() or getMax() functions above. recursiveSort(): This function will apply the same sorting method as normalSort, but in a recursive manner. Use a function swap(int &first, int &second) to swap two array elements. Printing out arrays: You should print out the array both before sorting, and after sorting using a function printArray(). Once youve written the function normally, implement a recursive version that does the same thing. printArray(): This function will print an array. printArrayRec(): This function recursively prints the array.

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!