quickselect

Same as select with two changes:

1. An additional input parameter: initial_pivot_index = the array index at which the first pivot value can be found. In theory, the pivot value can be chosen at random, but making an intelligent first guess close to the expected kth smallest (or largest) element is a good idea as that reduces the number of iterations needed to close-in on the target value (defaults to zero). 2. The return value: returns the kth element in the array as defined by the ordering predicate.

T
quickselect
()
(
T[] arr
,
size_t k
,
Pred pred = Pred.init
,
size_t initial_pivot_index = 0
)

Meta