Suppose we have a sport tournament with direct elimination. The original number of players is a perfect power of 2, say n. Each player is attributed a draw position, between 1 and n. The tournament's first round is organized in the following way:
- match 1: 1 vs 2
- match 2: 3 vs 4
- ...
- match n/2: n-1 vs n
Matches are numbered in order from top to bottom for each round.
Given a particular match, how can we express the range each player draw position can be from the round number and the match number ?
e.g:
- Round 2, match 1:
- P1 is in [1,2]
- P2 is in [3,4]
Round x, match m: P1 is in ? P2 is in ?
Thank you