# Puzzle | Single Elimination Tournament

In a single-elimination tournament, such as the tennis Grand Slam championships – every losing player is immediately eliminated from the subsequent rounds until a single player is determined. If there are **N** players at the beginning of the tournament, answer the following questions.

- What is the total number of matches needed to get a winner?
- How many rounds are there in such a tournament?
- How many more matches need to be played to determine the second-best player based on the information produced by the tournament?

**Solution**

- Since we are eliminating one player in each match, and there is only one winner. Then, in total
**N-1**players are needed to be eliminated. Hence,**N-1**matches are needed to get a winner. Mathematically, if there are**N**players, then we will have**N/2**matches in the first round,**N/4**matches in the second round, and so on until we have**1**match in the final round. So, the total number of matches is just the sum of the geometric progression, with terms**N/2, N/4 until 1**.Let there be a total number of N players, Then the total number of matches to obtain a winner:

=> N/2 + N/4 + N/8 + …. + 2 + 1

This is a geometric progression with

a = N/2, r = 1/2

The number of terms in the progression will beHence,

=> N/2(1 – (1/2)^{log_2N}) / 1 – 1/2)

=> N(1 – 1/2^{log_2N})

=> N(1 – 1/N)

=> (N – 1) - The total number of rounds in the tournament are
**log**if_{2}N**N**is a power of**2**, as in each round half of the players gets eliminated, until only one player is left. If**N**is not a power of**2**, then number of rounds are the smallest power of**2**, that is greater than or equal to N, which is equal to**ceil(log**._{2}N) - The second best player can be any player who lost to the winner and nobody else. These players can be made to play their own single elimination tournament. Since, the winner will be present in all the rounds of the tournament, so in total their will be
**ceil(log**players contending for the second best player. Since, for an_{2}N)**N**players tournament,**N-1**matches are played to find out the winner, hence,**ceil(log**matches are required to determine the winner among the contenders, which will be our second best player._{2}N) – 1