0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Asking for a data structure or algorithm in principle is fine, but asking for implementation here is off-topic. $\endgroup$ – Discrete lizard Apr 18 '18 at 7:27
  • $\begingroup$ I am sorry if that word confused you what I meant by implementation is not code but rather a basic psuedo-code/logic with which i can proceed $\endgroup$ – Niteya Shah Apr 18 '18 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.