I have a few questions on an assignment dealing with binary search trees and English-Latin vocab words. Here's the instructions for better understanding for my questions that will come afterwards
Each
unit in a Latin textbook contains a Latin-English vocabulary of words which have been used for the first time in a particular unit. Write a program that converts a set of such vocabularies stored in file
Latin into a set of English-Latin vocabularies. Make the following assumptions:
a. Unit names are preceded by a percentage symbol.
b. There is only one entry per line.
c. A Latin
word is seperated by a colon from its English quivalent(s); if there is more than one equivalent, they are seperated by a comma.
To output English words in alphabetical order, create a binary serach tree for each unit containing English words and linked lists of Latin equivalents. Make sure that there is only one node for each English word in the tree. For example, there is only one node for
and is used twice in
unit 6: with words
ac and
atque. After the task has been completed for a given unit (that is, the content of the tree has been stored in an output file), delete the tree along with all linked lists from computer memory before creating a tree for the next unit.
Here is an example of a file containing Latin-English vocabularies:
%Unit 5
ante : before, in front of, previously
antiquus : ancient
ardeo : burn, be on fire, desire
arma : arms, weapons
aurum : gold
aureus : golden, of gold
%Unit 6
animal : animal
Athenae : Athens
atque : and
ac : and
aurora : dawn
%Unit 7
amo : love
amor : love
annus : year
Asia : Asia
From these units, the program should generate the following output:
%Unit 5
ancient : antiquus
arms : arma
be on fire : ardeo
before : ante
burn : ardeo
desire : ardeo
gold : aurum
golden : aureus
previously : ante
weapons : arma
%Unit 6
Athens : Athenae
and : ac, atque
animal : animal
dawn : aurora
%Unit 7
Asia : Asia
love : amor, amo
year : annus
Ok, now a few questions. I'm not lookin for the answer to the problem, just want a few questions answered to get me goin in the right direction
1) Would you put the elements into the tree in order? Or would you put them in the tree, then make some loops to swap the values to get them in order?
2) Which would be the parent nodes, the latin or the english words?
3) How do you go about putting linked lists into the tree?
These are just a few to get me headed in the right direction, lol. Thanks for any help in advance!