Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 30th, 2002, 09:48 AM
damike damike is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 5 damike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation reversed binary tree

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

Reply With Quote
  #2  
Old March 30th, 2002, 01:20 PM
WoR WoR is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 20 WoR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!?!

Reply With Quote
  #3  
Old March 30th, 2002, 02:00 PM
damike damike is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 5 damike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up alright

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > reversed binary tree

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap