K largest elements from a big file or array.
Utilisateur anonyme
Store the first k elements in a temporary array temp[0..k-1]. 2) Find the smallest element in temp[], let the smallest element be min. 3-a) For each element x in arr[k] to arr[n-1]. O(n-k) If x is greater than the min then remove min from temp[] and insert x. 3-b)Then, determine the new min from temp[]. O(k) 4) Print final k elements of temp[]