I want to implement a tournament managing software , something like challonge(https://challonge.com/) and am currently stuck at the data structure to be used. I read up on tournament trees and a format like this, https://i.stack.imgur.com/UOMVI.png . The problem I am facing is in balancing it.
The method works very well for a power of 2 number of players but when the number of players is not a power of 2, it was suggested somewhere that I make it as the next highest power of 2 and fill the empty places with dummies with whom the opponent always gets a win ( basically a by) but then issue comes in inserting values. To explain my issue assume that are 100 players so we will have to use a 128 leaf node tree but the issue then is that if I do perform linear insertion in the tree leaves , the fourth quadrant of the tree will be almost empty with only 4 players. This basically would lead to that person going to the semis with two matches .
Is there some tree implementation that takes care of this issue where the leaf values can be evenly spread out so that we don't get a scenario like this. Any other method of implementation of this Problem is also good, as long as the data can be stored in a SQL database.