3
$\begingroup$

The setting

Let's consider a single elimination tournament with $n=2^r$ teams.

Usually the playoff tree is seeded in a way that the two top teams can meet no earlier than in the finals. Top 4 can't eliminate each other before semifinals etc.

The playoff bracket that guarantees these properties is the one where the top team gets paired with the last team, second with second-to-last etc. To pair the second round matchups, rank the first round pairs according to the higher seed and use the same rule.

In the end the playoff tree of 16 teams should look like this:

1
(p1)    wp1
16
        (p1.2)     wp1.2
9
(p8)    wp8
8
                   (p1.3)         wp1.3
5
(p5)    wp5
12
        (p4.2)     wp4.2
13
(p4)    wp4
4
                                 (p1.4)         wp1.4
3
(p3)    wp3
14
        (p3.2)     wp3.2
11
(p6)    wp6
6
                   (p2.3)         wp2.3
7
(p7)    wp7
10
        (p2.2)     wp2.2
15
(p2)    wp2
2

With p[p] I mark a pair, a wp[p] is the winner of the pair p[p].

A good playoff tree is the one where any subtree has the same properties as described necessary for the whole tree. For example, consider this subtree in the upper tree:

3
(p3)    wp3
14
        (p3.2)     wp3.2
11
(p6)    wp6
6

The two higher seeded teams (3 and 6) as on the very opposite sides of the bracket and can only meet at the latest stage. The strongest team here (3) is paired against the weakest of these (14).

The question

Let's number the slots in a round from top to the bottom.

Given s(A) - the seeding of team A and n - the number of teams, what will be the function that would return i - the number of slot for this team in the bracket.

What would be the inverse function (given slot number, return the teams seed - useful to find the opponent).

Examples

In a round of 16 (n=16) we must place team with seed s=13 in the bracket. The slot number must be i=7 - that team must be the first in the 4th pair.

For the inverse function, given that we placed s=13 in the 4th pair, we must find the opponent which will be the second team in that pair. So, given n=16 and the slot number i=8 we must get s=4 - seed of the 13s opponent.

I am looking for a function that would be applicable for arbitrary n instead of hardcoding the seed-slot relations for limited number of n values.

A note

This is a problem that is usually solved programmatically either by hardcoding an ordering or by an iterative process. I am interested if it's replacable with a single mathematical function that you could plug in a number and get another one out for any n. The relation between seeds and slots is a uniquely (if you always start with 1st seed) defined bijection so obviously you could just say that the function exists and let's call it pOff(s).

As you could probably guess, I am interested if this function is expressable with another, previously defined functions (special functions, complex numbers etc. is ok if necessary).

  • 1
    Shift all the numbers by $1$ so they lie in the range $0..15$. Now write them down in binary form, just the *first* number in each pair, and a strong pattern emerges: $0000, 1000, 0100, 1100, 0010, 1010, 0110, 1110$. These are precisely the binary numbers $0..7$ written **right-to-left**. This is the type of pattern that feels very likely to generalize to arbitrary lengths $r$.2017-02-09

1 Answers 1

0

I will start to solve the problem by listing some values for the playoff function $pOff(s,n)$ where $s$ - seed, $n$ - number of teams, $pOff(s,n)$ - number (order) of the team in bracket counting from top to bottom.

First seed goes at the top of the bracket, second at bottom:

$$ pOff(1, n) = 1 \\ pOff(2, n) = n $$

First seed gets paired with weakest, second with second-to-last:

$$ pOff(n, n) = 1 \\ pOff(n-1, n) = n-1 $$

Fourth seed goes on the upper side (with the first) but as far from the first as possible. Similarly with third and second:

$$ pOff(4, n) = n/2 \\ pOff(3, n) = 1 + n/2 $$

To proceed similarly we could write out some more values:

$$ pOff(5, n) = 1 + n/4 \\ pOff(6, n) = 3n/4 \\ pOff(7, n) = 1 + 3n/4 \\ pOff(8, n) = n/4 \\ pOff(9, n) = 1 + n/8\\ pOff(10, n) = 7n/8 \\ pOff(11, n) = 1 + 5n/8 \\ pOff(12, n) = 3n/8 \\ pOff(13, n) = 1 + 3n/8 \\ pOff(14, n) = 5n/8 \\ \dots $$

We can notice some patterns.

The first four seeds are aligned on the extremities of half-brackets. The next four occupy the remaining extremities of all quarterbrackets etc. This is all according to the definition of a "good" bracket.

So we now know that any slot is writable in the form:

$$pOff(s,n) = p + k n / 2^c$$

where $p=1$ or $p=0$, $c \in \mathbb{Z}$ and $c >= \lfloor\log_2(s-1)\rfloor$.

If we want to use exactly the forms above we could reduce the fraction $k/n$ and we will obtain $c = \lfloor\log_2(s-1)\rfloor$ ($2^c$ will be the largest power of 2 which fits inside $s$). As $k$ is reduced with a power of two, it becomes an odd number in the end.

So the form will be:

$$pOff(s,n) = p + \frac{k n}{2^{\lfloor\log_2(s-1)\rfloor}}$$

where $p$ is either 1 or 0, $k$ is an odd number between $1$ and $2^{\lfloor\log_2(s-1)\rfloor}$. As we know that we will have the same denominator for all $2^{\lfloor\log_2(s-1)\rfloor}$ seeds but all the assigned slots must be different, we know that $k$ and $p$ will have all the possible combinations.

Guessing

It seems that the odd seeds always get odd slots, but I don't know if that is always correct.

If it is true then:

$$pOff(s,n) = (s \bmod 2) + \frac{kn}{2^{\lfloor\log_2(s-1)\rfloor}}$$

Now can we prove that this is correct? And how can we find the $k$.

I also noticed that $k=1$ for $s = 1 + 2^{\lfloor\log_2(s-1)\rfloor}$ and $s = 2^{\lfloor\log_2s\rfloor}$ (for example, $k=1$ for $s=9$ and $s=16$). But I have no idea how to proceed from here...