|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i really need a class for a reversed binary tree!
i want to do a tournament admin system with double out. which means there is a_ _ a b a competes against b. if a wins then a is one more step to the root if b wins then ofcourse the other way round. i need to access every node and need to parse through the whole tree starting in the lowest branch and going up to the root! if anyone has a class or the algorithm please post here or post a link. thx - hope everyone understood what i need ![]() |
|
#2
|
|||
|
|||
|
I suppose I don't really understand the problem.
In a simple binary tree, copying the winner of a match to the parent (discard the children if you want) as can be seen in every display of tournaments should do the job: e.g x means empty quaterfinals x x x x x x x a b c d e f g h a wins against b d wins against c e wins against f g wins against h Semifinals x x x a d e g a b c d e f g h d wins against a e wins against g Finals x d e a d e g a b c d e f g h d wins against e d d e a d e g a b c d e f g h So a simple fully balanced binary tree with a depth first access should do the job!?! |
|
#3
|
|||
|
|||
|
this would mean i would have to built the whole tree first!
i dont want to do that since i put the data in a mysql table! but basically you are right - i just thought someone already has a class for that. i would actually need two binary trees because there is also a looser bracket (every team can loose once). thx, anyways |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > reversed binary tree |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|