Question: [Algorithms Design and Analysis] Describe an algorithm which, given an unsorted integer array of size n (1,000 n 10,000,000) and a positive integer k (1
[Algorithms Design and Analysis] Describe an algorithm which, given an unsorted integer array of size n (1,000 n 10,000,000) and a positive integer k (1 k 100), computes the average of the k largest integers in the array. You may assume that the integers in the given array are all distinct, i.e. no integers occurring more than once. Your algorithm should have a worst-case time complexity of O(n log k). Describe your algorithm by means of pseudocode and analyze its worst-case time complexity.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
