DSA Lab Final Exam (Spring 2023)
Allowed Time = 90 minutes
Version: X1
Instructions for Invigilators:
1. Students will have total 90 minutes to finish the whole exam.
2. It is up to the students to manage their time.
Instructions for Students:
1. There are only 2 questions in the exam.
2. Late submissions will NOT be considered.
3. Create as many classes and functions as required. Remember, one
function for one functionality.
4. Plagiarism will not be tolerated in any case.
5. Use meaningful variable names, and take care of naming conventions
and indentation.
Time allowed = 90 minutes;
Marks: 100 = 50 + 50
Question 1:
Suppose you are working for a delivery service that needs to manage all couriers
responsible for each parcel to be delivered. Each parcel is identified by a unique
tracking number. Your team has decided to use an unordered_map to store
the courier names for each parcel, with the tracking number as the key.
Write a C++ program to implement this system and support the following
operations using a menu:
1. Insert a new courier name into the map for a given tracking number
2. Delete a courier name from the map for a given tracking number
3. Print all tracking numbers and corresponding courier names in the map
4. Exit
Question 2:
Suppose you are creating a program for a university to manage its courses. A
unique integer course code represents each course. You decide to use a binary
search tree to store these course codes, with an integer value placed on each node.
Write a C++ program that provided the registrar of the university to perform the
following actions using a menu:
1. Add new course codes to the system
2. Display all the course codes in the system using pre-order traversal
3. Search for a specific course code
4. Display the course code having the smallest value
5. Exit