The Tournament
摘要
The problem of deciding the winner in a sport tournament is interpreted and coded as one of determining the maximum in a set of integers. Two solutions are compared, respectively based on performing a linear scan of the elements and on setting up a knockout stage among them. Remarkably, these two completely different strategies lead to algorithms of identical computational cost. The surprisingly nontrivial problem of finding the second largest element is also considered.