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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle | Elevator Puzzle
- Puzzle 39 | (100 coins puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 31 | (Minimum cut Puzzle)
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle | The Pot of Beans
- Puzzle | Words without 'a'
- Puzzle | Who killed him?
- Puzzle | Truth and Lie

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.