-
Binary Taxonomy Tree
I am writing a binary taxonomy tree program that reads from an file and reconstruct the tree. The program will learn from the users and expand the tree.
The requirement is each node must contain an 'index' or 'key' value to be used for reconstructing the tree from the input file, using the BINARY SEARCH TREE method of insertion.
The question is how can I use 'index' to determine where the parents and children should go in the tree? If I use number, do I just pick a number randomly and assign to each node? Thanks in advance.
-
>> each node must contain an 'index' or 'key' value ... using binary search ... insertion
Looks like the index/key value simply describes the 'order' for each node - so they can be sorted. So just think of it as a tree of key values (integers).
gg
-
Actually, I think it's a taxonomy tree, where keys are used to identify the species (or genus) of some living thing (plants, fungus, fauna - I think there's one or two further groups).
It's essentially a "yes/no" tree where each point leads closer to a defined species (or genus, or family).
When these trees are generated manually, the keys are usually just generated as numbers.
The trouble with forming the tree is to place new keys in teh right place, because the differentiating factor may not be best placed at the point where the tree "ends", but further up. In the case of an educated user, it may actually be OK to ask "where do you want to insert this key", and list the steps to get to the current point.
Of course, I could have misunderstood the question, in which case I suggest everyone ignore my blabberings.
--
Mats