1/15
Looks like no tags are added yet.
FIFO
First In, First Out; a principle where the first element added to a queue is the first one to be removed.
Queue Interface in Java
A set of methods from the java.util package used to implement queues in Java.
LinkedList
A class in Java used to instantiate a Queue object since interfaces cannot be instantiated.
collections.deque
A module in Python used to implement queues, imported with the statement `from collections import deque`.
Enqueue
The operation of adding a new item to the queue.
Java Enqueue Example
`Queue queue = new LinkedList(); queue.offer("Lisa");` - demonstrates how to add an item in Java.
Python Enqueue Example
`queue = deque([]); queue.append("Lisa")` - demonstrates how to add an item in Python.
Dequeue
The operation of removing the head (first element) of the queue.
Java Dequeue Example
`poll();` - method used to remove the head of the queue in Java.
Python Dequeue Example
`popLeft()` - method used to remove the head of the queue in Python.
Peek
The operation of retrieving the head of the queue without removing it.
Java Peek Example
`peek();` - method used to retrieve the head of the queue in Java.
Python Peek Example
`queue_name[0];` - retrieves the head of the queue in Python.
isEmpty
A method to check whether the queue is empty.
Java isEmpty Example
`isEmpty();` - method used to check if the queue is empty in Java.
Python isEmpty Example
`if not queue:print("Queue is not empty");` - checks if the queue is empty in Python.