Queue operations (enqueue, dequeue)
π Scenario: Imagine you are managing a line of customers waiting to buy tickets at a movie theater. You need to keep track of who is in line and in what order they arrived.
π― Goal: You will build a simple queue system that can add customers to the line (enqueue) and remove customers from the line when they buy their tickets (dequeue).
π What You'll Learn
Create a list called
queue to hold customer names.Create a variable called
max_size to limit the queue length.Add a function called
enqueue to add a customer to the queue if there is space.Add a function called
dequeue to remove the first customer from the queue.π‘ Why This Matters
π Real World
Queues are used in many places like lines at stores, print job management, and customer service systems to keep things organized and fair.
πΌ Career
Understanding queue operations is important for software developers, system administrators, and anyone working with data processing or task scheduling.
Progress0 / 4 steps