Creating a Queue with O(1) Operations
Learn how to create a queue with constant-time enqueue and dequeue operations.
We'll cover the following...
Creating a Queue with O(1) Operations
NOTE
For this problem, familiarity with queues, hash tables, and linked lists would help.
Instructions
Create a queue data structure with O(1)
insertion, deletion, and size calculation.
Queue
A queue is a data structure that keeps track of data in the order in which it was entered. Items are inserted into the back of the queue and removed from the front of the queue.
A real-world analogy would be a line at a grocery store. Everyone enters the line at the back. The first person who enters will be the first person served.
Common operations available to perform on a queue are:
enqueue
, or