Question: Suppose we want an algorithm which, for an input of integers a1, a2,... ,an, outputs the largest and second largest integers. It is proposed to sort the list in decreasing order and to output the first two integers of the sorted list.
(a) In terms of comparisons, what is the best complexity function for this algorithm?
(b) Is there a better way to proceed? Explain and, if the answer is yes, describe a better algorithm.