I’m trying implement a bracket in my program (using C#/.NET MVC) and I am stuck trying to figure out some algorithm.
For example, I have a bracket like this with 8 entries (A,B,C,D,E,F,G,H)

I’m trying to figure out if there’s an algorithmic way to
-
depending on # of entries, find # of
games per round -
depending on # of entries, for a
specific game #, what is the
corresponding game # in the next
round?
For example, in this case, for 8 entries, the example are:
- for round 1, there are 4 games. Round 2, 2 games. Round 3, 1 game
- game 2 in round 1 corresponds to game 5 in round 2.
I also thought about storing this info in a table, but it seems overkill since it never changes, but here it is anyway:

Any help will be greatly appreciated!
Cheers,
Dean
Quoting @Yuck who answered the first question perfectly.
C# code for the first part of your question:
Moving on to the second question: