Skip to main content

Deque

Instantiate an empty Deque.

Usage

Deque()

Methods

MethodDescription
is_emptyReturns whether a queue is empty
peekReturns the element at the top of the queue
dequeueReturns and remove the element at the front of the queue
enqueueAdd an item to the back of the queue
enqueue_frontAdds 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