Deque
Instantiate an empty Deque.
Usage
Deque()
Methods
| Method | Description |
|---|---|
| is_empty | Returns whether a queue is empty |
| peek | Returns the element at the top of the queue |
| dequeue | Returns and remove the element at the front of the queue |
| enqueue | Add an item to the back of the queue |
| enqueue_front | Adds an item to the front of the queue |
Example
from jellybeans.structures import Dequeq = Deque()q.enqueue(20)q.enqueue(29)print(q) # 20 -> 29