Professional Documents
Culture Documents
FA 2021 DS Algo LAB 04
FA 2021 DS Algo LAB 04
CL210
LABORATORY MANUAL
Fall 2021
LAB 04
Stacks and Queues
Engr. Shahid Qureshi
______________________________________
LAB ENGINEER SIGNATURE & DATE
2. Equipment Required:
A working computer having Visual Studio or any other good compiler Installed.
Example:
Priority Queue
A priority queue allows entries to be retrieved according to some specified priority levels.
The highest priority entry is removed first
Entries with equal priority can be removed according to FIFO as queue.
Link list implementation for the Stack is provided with the lab manual.
1. Develop a program which can evalueate a postfix mathematical expression using the stacks as
illustrated in the lecture slides.
2. Implement a Priority Queue as illustrated in the diagram given above. Code for the simple
queue is given in the slides. You need to modify it to accommodate a priority number for every
data item. Here is the modification you need to do:
struct QueueNode
{
int priority;
int info;
QueueNode *link;
}
Test your priority queue implementation by pushing data of various priority levels, and then
popping out some data.
Submission: