Problem 1: In NIT Durgapur, there is a popular bakery named Wonder Cafe known for its delicious pastries and cakes. The bakery has a unique system in place to manage its orders. When customers arrive, they are given a token number and are told to wait in a special queue. The bakery has a stack of order slips, and when an order is ready, the cashier takes the top order slip from the stack, calls out the token number, and hands the order to the customer. Here, the token worker takes the first token from the stack for the customer who comes first in the queue, ensuring that they get their food first. You also analysis of the time complexity of push(Item) and pop() function. It's crucial to evaluate the efficiency of these functions in terms of time complexity.
Problem 2: Imagine you're managing a theme park ride where visitors line up in a queue before boarding. Your challenge is to create a digital queue system using stacks. You'll need to implement functions for adding visitors to the queue (enqueue(Item)) and for letting them onto the ride (dequeue()), using the push(item) and pop() functions from your stack. Additionally, you should analyze how efficient these functions are in terms of time complexity.Â
Problem 3: Generate Binary Numbers from 1 to n using queue
Examples:
Input: n = 3
Output: 1, 10, 11
Input: n = 4
Output: 1, 10, 11, 100
Input: n = 5
Output: 1, 10, 11, 100, 101
Problem 4: At NIT Durgapur, there's a medical clinic called MedicalUnit. Here, people come when they need urgent medical help. To make sure everyone gets the right care quickly, the clinic uses a special system called a priority queue.
When someone comes in, the nurses check how serious their problem is. They give each person a priority level based on this. If someone is very sick or badly hurt, they get the highest priority.
Inside the clinic, there's a special desk where nurses work. They have a stack of papers with all the patient information. Each paper shows how urgent the person's problem is. When a doctor is free to see a patient, the nurse takes the paper with the highest priority from the top of the stack. This makes sure the most serious cases are seen first.
During the day, the patients are helped based on how urgent their problem is. Those with the most serious problems get help right away. This system helps MedicalUnit give the best care to everyone who comes in.
The nurses keep an eye on the stack of papers all day. They make sure the most urgent cases are seen quickly. This way, everyone gets the help they need, no matter how serious their problem is.