Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview For project 3 , given an input file of integer values, you will compute all the statistics included in a five - number summary
Overview
For project given an input file of integer values, you will compute all the statistics included in a fivenumber summary or a box plot: the minimum value, the thth and th percentiles, and the maximum value.
The integers in the input will be sampled from a gamma distribution. Because of the characteristics of gamma distributions, as the input size increases, the number of unique values will grow slowly, and there will be an increasing number of duplicates, yet there is no absolute upper limit on the values. This will make the input a good candidate for a hashbased counting sort.
You will compute the fivenumber summary with each of the following methods, and benchmark the time taken for each method:
Use std::sort
Use quickselect times, then calculate the min and max separately
Modify quickselect to recurse if any of the values are in the subrange
Use a modified counting sort that uses hashes
For method find the median first. Then, on the same vector that's already partitioned around the median, call quickselect on the left half to find P and on the right half to find P Then, search the part of the vector below P for the min and above P for the max.
For method modify quickselect's recursive function to take a short list of keys rather than just one key. If you refer to p in the textbook, you can replace the parameter int k with a small vector or list. Then rewrite the recursive portion so that quickselect calls itself on one or both sides, depending on whether there are positions you're searching for on both sides or only one.
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