更新时间:2022-12-11 08:19:01
查找第k个最大的元素,使用选择算法 。
结果接下来,遍历数组,发现这是更大的所有元素/平等的。
Find the kth biggest element, using selection algorithm.
Next, iterate the array and find all elements which are larger/equal it.
的复杂性:作为选择和O(N)为迭代O(N),所以总也为O(n)
complexity: O(n) for selection and O(n) for iterating, so the total is also O(n)