I am going to suggest that a read-only array is a strong requirement and is trying to find compromises that do not violate it in this answer (therefore, using selection, the algorithm is not an option since it modifies the array)
, wikipedia, O (1) :
, k + O (1) ( n - k, k > n/2), O (1) ....
O (k) O (nlogk). , k , O(1)
, heap k. k , . - x , x.
, - k th .
O O(n) O(k) space, 2k, , k th. , k'th, ( k). O(k*n/k) = O(n)
, , .
O (1) , , k . , . O(nk) O (1) , , , .