0% found this document useful (0 votes)
26 views5 pages

DSA - Mini - Project Faheem

The document describes a mini project that implements a task management system using a queue data structure. It includes the Queue class definition and main function that provides a menu for users to add, process, and view tasks in the queue on a first-in, first-out basis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

DSA - Mini - Project Faheem

The document describes a mini project that implements a task management system using a queue data structure. It includes the Queue class definition and main function that provides a menu for users to add, process, and view tasks in the queue on a first-in, first-out basis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DATA STRUCTURES AND ALGORITHMS

(CS3291)

MINI PROJECT
ON
QUEUE

Mohamed Faheem S
IT 2nd year
210622205041
QUEUE

Aim:
To implement a simple task management system using a queue data structure.
Explanation:
- The `Queue` class is implemented with basic queue operations (`enqueue`,
`dequeue`, `is_empty`, and `size`).
- The `main` function initializes a task queue and provides a simple menu for
users to add tasks, process tasks, view tasks, or exit the system.
- The program continues running until the user chooses to exit.
Source code:
class Queue:
def __init__(self):
self.items = []
def is_empty(self):
return len(self.items) == 0
def enqueue(self, item):
self.items.append(item)

def dequeue(self):
if not self.is_empty():
return self.items.pop(0)
else:
print("Queue is empty.")
return None

def size(self):
return len(self.items)
def main():
task_queue = Queue()

while True:
print("\nTask Management System:")
print("1. Add Task")
print("2. Process Task")
print("3. View Tasks")
print("4. Exit")

choice = input("Enter your choice (1-4): ")

if choice == "1":
task = input("Enter the task: ")
task_queue.enqueue(task)
print(f"Task '{task}' added to the queue.")

elif choice == "2":


processed_task = task_queue.dequeue()
if processed_task is not None:
print(f"Processed task: '{processed_task}'")

elif choice == "3":


if task_queue.is_empty():
print("Task queue is empty.")
else:
print("Tasks in the queue:")
for task in task_queue.items:
print("- " + task)

elif choice == "4":


print("Exiting Task Management System. Goodbye!")
break

else:
print("Invalid choice. Please enter a number between 1 and 4.")

if __name__ == "__main__":
main()

OUTPUT: -
CONCLUSION
In conclusion, the implemented Task
Management System using a queue provides a straightforward
example of how queues, a fundamental data structure, can be utilized
in a real-world scenario. The code allows users to add tasks to a
queue, process tasks in a first-come, first-served manner, and view the
current tasks in the queue. The system demonstrates the simplicity
and efficiency of using a queue to manage tasks in a sequential order.

********

You might also like