Question: develop code for classes to read and analyze binary data. Write a function named selection _ sort ( ) which takes two parameters, a integer
develop code for classes to read and analyze binary data.
Write a function named selectionsort which takes two parameters, a integer pointer and an integer size. Add code to implement a selection sort algorithm. Add any needed functions to support the selection sort.
Write a helper function named binarysearch that takes three parameters, the first is an integer array, the second is the searched for value, and the third is the array size. This function calls the recursive function and passes the array, the search value, the starting index, and the last index.
Write a recursive function named binarysearchrecursive which takes four parameters passed from the helper function. The first is an integer pointer representing the array of values, the second is an integer representing the value to be searched for, the third is an integer for the starting index, and the fourth is an integer for the ending index.
Add a new class named SearchAnalyzer which subclasses Analyzer and implements the analyze method. Use the override keyword appropriately. The constructor should first call the selectionsort function, passing the integer array and the size. In the analyze method, generate random integer values in the range of to and use the binarysearch function to see if that value exists in the data. Count the number of found values and return the count in a std::string.
Modify the StatisticsAnalyzer analyze method to call the selectionsort function. Alter the computation of the minimum and maximum values considering that the array is sorted. Add functionality to implement the median and mode averages using the sorted data. The median is the exact middle value if there are an odd number of elements and the mean of the two middle values if there are an even number of elements The mode is the most frequently occurring value; if more than one value occurs with this frequency, pick the first one.
Use these function and class headers:
class SearchAnalyzer : public Analyzer
SearchAnalyzer int values, int size
std: :string analyze;
bool binarysearchrecursiveint values, int key, int start, int end
bool binarysearchint values, int key, int size
void selection sort int values, int size
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
