如果我使用修改后的快速排序版本来查找数组中的第 k 个最小项,为什么预期的运行时间为 O(n)(如 Programming Pearls 书中所述)?
我正在使用的算法执行以下操作:
1) Runs quick sort on the array
2) If k is > the correct location of pivot, then run quicksort on the 2nd half.
Otherwise run it on the first half.
我的印象是这需要 O(n * logn) 的工作。