Question: Need help with creating this function --- int partitionAround(vector &A, double k); Problem 8. Partition around median. Given a vector A of distinct integers and
Need help with creating this function --- int partitionAround(vector

Problem 8. Partition around median. Given a vector A of distinct integers and given k, the median of A (the median might be a decimal number, e.g. 3.2). Partition items of A so that all items in the first half of A are less than or equal to k and a items in the second half of A are greater than k. Write a function that partitions integers of A in place (do not use any additional data structure) and does the fewest number of operations (such as comparisons, assignments) You need to write the following function with the exact header as shown: int partitionAround(vectorcint> &A, double k); (Note that vector A is passed by reference, but not const, because this function will change A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
