Question: Answer the following questions about the QuickPick algorithm below. This algorithm returns takes in an array data and a target index i, and it returns

Answer the following questions about the QuickPick algorithm below. This algorithm returns takes in an array data and a target index i, and it returns the ith smallest element of data. Input: data: an array of n inte gers Input: n: the size of data Input: i: an integer in the range 1-n Output: the ith smallest element of data 1 Algorithm: QuickPick 2 Let pivot be a random element of data s Partition data as in QuickSort, with all elements to its left pivot and all elements to its right 2 pivot 4 Let p be the location of pivot afterwards 5 if p-i then 6 return pivot 7 else if p
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
