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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!