Sort the following array a using quicksort,
[6, 11, 4, 9, 8, 2, 5, 8, 13, 7]
The pivot should be chosen as the arithmetic mean of the first
By the way the question is worded, the pivot should just be 6 and not necessarily the 6th item in the array.
This is most definitely the case because if there were only 3 items in the array, for example, and the arithmetic mean came out to be greater than 3, you would have no pivot to choose because there is no item with that index.
Note: Be careful with the way you index elements in your array. You said the 6th element is '2', when it may be '5' if your programming language starts indices at 0.