Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2015/functional-programming-design-and-analysis-of-algorithms/5/c/solution

The first value is the tournament winner . Find the second value by taking the maximum of the direct-loser set , retaining its associated tournament record.
The third-largest value must have lost directly to either or : any other value is smaller and could not defeat it. Therefore it belongs to
Conversely, every value in is distinct from . Thus the third-largest value is . This is tournament selection of the three largest elements; it uses the retained defeat records while computing the requested three-part partition.
Three largest elements exist only for . With the paper's power-of-two assumption this means . The partition in part (b) remains meaningful for , but a third output cannot be supplied in that case.

New to topics? Read the docs here!