Question: Consider the following algorithm outline for finding the maximum, second - largest and third largest in a list of n keys. Initially: List contains n

Consider the following algorithm outline for finding the maximum, second-largest and third largest in a list of n keys. Initially: List contains n keys (assume n is a power of 2) While List size n 2 For every pair of keys Find the larger ( store the loser in a loser list for the winner) Let List contain the n/2 winners End. Now List contains Maximum (Winner). Second_largest = max( list of losers to Maximum). Third_largest = max((list of losers to maximum second_largest) U list of losers to second_largest ) a- Find the exact number of key comparisons made by the above algorithm. b- Find the amount of extra space required by the algorithm? c- Apply the algorithm to the following set of keys and show the Loser Lists. 10503090401007060

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 Programming Questions!