University of Tabuk CSC1204 Data Structures and Algorithms
Faculty of Computers and IT LAB5 Assignment
Due Date: 30/4/2025 11:59 PM
LAB5 Assignment: Stack & Queue
Objective:
Develop a C++ program to understand and implement Stack and Queue data structures using classes. This
lab focuses on handling complex data (e.g., student or task records) using both array-based and linked
list-based implementations.
Part 1: Stack Implementation
• Implement a Stack that stores task/job records. Each record should include:
o Task ID (integer)
o Task Name (string)
o Priority Level (integer)
o Estimated Time (in minutes, integer)
1. Tasks:
• Push a Task Record
Write a function to push a new task onto the stack.
• Pop a Task Record
Write a function to remove the top task from the stack.
• Peek at Top Task
Write a function to view the top task without removing it.
• Check if Stack is Empty
• Display All Tasks
Show all task records from top to bottom.
• Count Tasks in Stack
• Search by Task ID
Allow searching for a task using its ID.
• Calculate Total Estimated Time
Sum the estimated time of all tasks currently in the stack.
University of Tabuk CSC1204 Data Structures and Algorithms
Faculty of Computers and IT LAB5 Assignment
Part 2: Queue Implementation
• Implement a Queue that manages customer service requests. Each record should include:
o Request ID (integer)
o Customer Name (string)
o Service Type (string)
o Request Time (string, e.g., 10:30 AM)
2. Tasks:
• Enqueue a Request
Add a new service request to the queue.
• Dequeue a Request
Remove the front request from the queue.
• Peek at Front Request
View the front request without removing it.
• Check if Queue is Empty
• Display All Requests
Show all service requests from front to rear.
• Count Requests in Queue
• Search by Request ID
Allow searching for a request using its ID.
• Find Requests by Service Type
List all requests of a specific service type.