1. Engineering
  2. Computer Science
  3. need help with creating this function int partitionaroundvectorltintgt ampa...

Question: need help with creating this function int partitionaroundvectorltintgt ampa...

Question details

Need help with creating this function --- int partitionAround(vector<int> &A, double k);

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)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution