On 14 Okt, 00:03, Steven D'Aprano <ste... at REMOVE.THIS.cybersource.com.au> wrote: > Obviously to run in O(log n) you must have already built the tree. You don't need a tree. Quickselect is a partial quicksort. But my memory served me badly, quickselect is O(n).