Zhong Chihwei

Greenhorn
+ Follow
since Jun 19, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Zhong Chihwei

Thanks Dennis! That crossed my mind too; I'm still kind of a noob with enums. o.o

I tried implementing a sorted tree structure and ended up with an ugly problem. Here's an example:

"For D men's doubles, lets say there are 20 teams. That means that I will need 19 matches to determine a winner. To create matches, I first calculate that I need 10 starting matches, and then 9 more matches with yet-to-be determined competitors to eventually crown a winner. Each of these 19 matches that I create has it assigned a unique match number equal to the static numMatchesCreated value and then subsequently added to a sorted tree structure."

What I would like:

19
17 18
13 14 15 16
5 6 7 8 9 10 11 12
1 2 3 4
(The numbers represent match numbers)

However, when I insert each of these matches in one at a time into the tree, the tree degenerates into an array with the root being 19 and the bottommost leaf being 1.

1. Should I even use a sorted tree structure? (My cs knowledge is a bit limited, but I think the sorted tree algorithm is a heap, and I'm not sure if that's what I want)
2. If so, is there any way to sort it by breadth instead of in a heap manner?
3. Is there any way to balance it?

Thanks for all the help in advance.
11 years ago
Hi All! This is my first post. I apologize ahead of time if this post has any problems (length, format, etc.)

I am trying to design software to generate draws for a badminton tournament and wanted some help (comments/feedback) making design choices. Each player's information is stored inside of a comma delimited text file that I parse inside of the software (just a Java program for now; would like to integrate it into a GUI). The goal of the software is take all the information and construct 20 draws for 20 events, where each draw gives information on who plays who.


The basic structure I have set up so far:
-CompetingEntity Abstract Class: extended by Participant and Team Classes. (A team consists of two participants)
-Event Class: represents a particular event flight. (There are 4 flights : A B C D. 5 event types: mens singles, mens doubles, womens singles, womens doubles, and mixed doubles. 20 total events)
-All participants are stored inside of a HashMap, and events in a separate HashMap. Each participant stores a String denoting the events he/she is in, and each event stores a list of participants.
-Match Class: represents two competing entities that must play each other.
-Miscellaneous: when parsing the txt file, there are participants whose partners cannot be matched up (either missing partner names and/or spelling inconsistencies). I used two linkedHashSets to store
a needPartnersList and a mismatchedPartnersList

My questions:
1. I know I haven't given enough information, but thoughts on my choices for data structures so far? (efficiency, memory allocation, simplicity, etc.)
2. What type of data structure should I use for a draw, and how should I go about implementing the logic? (My thoughts: some type of tree structure seems most natural.)

Thanks all!
11 years ago