The way to think about a solution is like a series of tennis tearing competitions. Suppose each number corresponds to a player. Combine the numbers and let each game correspond to a comparison of numbers within a pair:
Games: (a1,a2) , (a3, a4) , (a5, a6) , (a7, a8)
Winners: a12 , a34 , a56 , a78
Games: (a12, a34) , (a56, a78)
Winners: a1234 , a5678
Game: (a1234, a5678)
Winner: a12345678
Number of games = 7 ==> (n - 1)
The second best result will be defeated only by the winner. Suppose a3 is the winner. Then the second best would be a4 , a12 or a5678 .
Games: (a4, a12)
Winner: a412
Games: a(412, 5678)
Winner: a4125678
So, we have games 2 for the second best ==> (lg(n) - 1)
Therefore, the number of games = 7 + 2 = 9 = (n + lg(n) - 2)
It is easier to visualize the above tree competition:
a12345678 / \ / \ / \ / \ a1234 a5678 / \ / \ / \ / \ a12 a34 a56 a78 / \ / \ / \ / \ a1 a2 a3 a4 a5 a6 a7 a8
If a3 is the winner, we have:
a3 | /----|----\ / \ / \ / \ a3 >==========> a5678 / \ / \ / \ / \ a12 <====< a3 a56 a78 / \ / \ / \ / \ a1 a2 a3 ->a4 a5 a6 a7 a8
Basically, the final winner a3 will go from leaf to root ( lg(n) -1 ). On his way, he will defeat the second best player, who is one of {a4, a12, a5678} . Thus, we can simply find out who is second, looking at the maximum on the path, except for the winner, who is described as described.