subject

Write a Queue class. The class is detailed as follows: ●__init__(self, capacity) → None
oComplexity: O(1)
oValid Input: An integer in (0, ∞]. Use a default, valid capacity on invalid input.
oThis is the constructor for the class. You will need to store the following here:
▪The head pointer
▪The tail pointer
▪A variable maxSize
▪A variable currentSize
▪Any other instance variables you want.
●enqueue(self, ticket) → boolean
oComplexity: O(1)
oValid Input: An object of type: MealTicket. Return False on invalid input.
oThis is the enqueue method. It will add a meal ticket to the queue. It will then return True/False depending on if the enqueue was successful (Hint: Add a new ticket at the tail of the queue).
●dequeue(self) → MealTicket/ boolean
oComplexity: O(1)
oThis is the dequeue method. It will remove the ticket at the front of the queue andreturn it or False if the queue is empty. (Hint: Dequeue a ticket at the head of theQueue).
●front(self) → MealTicket/ boolean
oComplexity: O(1)
oThis method lets the user peak at the ticket at the front of the queue without deleting it. It will either return a meal ticket or false if the queue is empty.
●isEmpty(self) → boolean
oComplexity: O(1)
oThis method will return True/False depending on if the queue is empty or not.
●isFull(self) → boolean
oComplexity: O(1)
oThis method will return True/False depending on if the queue is full or not,

Your program must perform exactly as shown in the figure. Note 2: All methods in the queue class have a hard complexity upper bound of O(1). Your implementation must be in O(1). Note 3: For this assignment you must make and use your own linked list as the base data structure. Using lists, dictionaries or any other data structure will result in a 0 for the assignment

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Which of the following is a way the operating system prevents unknown or unauthorized users from accessing the system?
Answers: 2
question
Computers and Technology, 22.06.2019 09:00
Meenu wants to create a high quality drawing in a variety of colours. which device should she use for the same?
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
You know the right answer?
Write a Queue class. The class is detailed as follows: ●__init__(self, capacity) → None
oComp...
Questions
question
Mathematics, 03.03.2021 02:30
question
Mathematics, 03.03.2021 02:30
question
Mathematics, 03.03.2021 02:30
question
Mathematics, 03.03.2021 02:30
question
Mathematics, 03.03.2021 02:40
Questions on the website: 13722361