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
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