PRACTICAL EXAM – CSD203
FALL 2025
Duration: 60 minutes
Route ID
City 1
City 2
Travel time (h)
1
C1 (New York)
C2 (Chicago)
2.5
2
C1 (New York)
C4 (Miami)
3
3
C2 (Chicago)
C3 (Los Angeles)
4
4
C2 (Chicago)
C5 (Toronto)
1.5
5
C3 (Los Angeles)
C4 (Miami)
4.5
6
C5 (Toronto)
C1 (New York)
1.5
7
C5 (Toronto)
C6 (London)
7
8
C6 (London)
C7 (Paris)
1.5
9
C7 (Paris)
7.5
Zoom
C1 (New York)
Given a small database of cities and travel time between them as the above table. It is used for
the following questions.
Q1. (PE_FA25_Q1.py) Write a PriorityQueue class utilizing linked-list-based priority
queue structure to manage the data as described in the above table. The priority queue includes:
1. [0.5 points] Route class to encapsulate Route Identification (rid), City1 (name), City2
(name), and travel time (number) between City1 and City2.
2. [0.5 points] Node class to encapsulate route as data and next as pointer pointing to next node.
3. [1 point] enqueue method to add a new node to the queue where the key to sort is travel
time.
4. [0.5 points] dequeue method to take the front element of the queue out of the queue.
5. [0.5 points] display method to print out all routes.
6. [0.5 points] Test your implementation.
Q2. (PE_FA25_Q2.py) Write a MinHeap class which includes:
1. [0.5 points] Route class to encapsulate route identification (rid), City1 (name), City2 (name),
+ 100%
Close