You are on page 1of 1

Data Structures and Algorithms Home Work 06

D a t a S t r u c t u r e s a n d A l g o r i t h m s
Home Work 06 Marks 10
Instructions
Work on this home work individually. Absolutely NO collaboration is allowed. Any traces of plagiarism would result in a ZERO marks
in this homework and possible disciplinary action.

Due Date
Paste the solution(s) folder of the problems (source code .cpp files only) labeled with your complete roll number in ITM – HW 06
and ITA – HW 06 folders for IT Morning and IT Afternoon sections respectively till Tuesday, May 28, 2019 before 02:00 PM. These
folders are available at \\printsrv\Teacher Data\Umair Babar\Students.

Urdu-English Vocabulary
Each unit in a Roman Urdu (Urdu) textbook contains an Urdu-English vocabulary of words that have used for the first time in a
particular unit. Write a program that converts a set of such vocabularies stored in a file input.txt into a set of English-Urdu
vocabularies. Make the following assumptions:

 Unit names are preceded by a dollar ($) symbol.


 There is only one entry per line.
 An urdu word is separated by a colon from its English equivalent(s); if there is more than one equivalent, they are separated
by a comma.

To output English word in alphabetical order, create a binary search tree for each unit containing English words and linked list of
Urdu 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’, although ‘and’ is used twice in unit 1: with word ‘aor’ and ‘aur’. After the task has
been completed for a given unit (that is, the content of the tree has been stored in an output file, output.txt), 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 Urdu-English vocabularies:


$Unit 1
janwar : animal
mera : my
aor : and
aur : and
subha : dawn

$Unit 2
piyar : love
muhabbat : love
saal : year
nafrat : hate
sunehra : golden, of gold

From these units, the program should generate the following output:
$Unit 1
and : aor, aur
animal : janwar
dawn : subha
my : mera

$Unit 2
hate : nafrat
love : muhabbat, piyar
year : saal
golden : sunehra
of gold : sunehra
NOTE: - No submission will be accepted after the DUE DATE and TIME.
B E S T O F L U C K

Umair Babar, PUCIT – PU. Lahore. Page 1 of 1

You might also like