Skip to main content

Queue

Instantiate an empty Queue.

Usage

Queue()

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

Example

from jellybeans.structures import Queueq = Queue()q.enqueue(20)q.enqueue(29)print(q) # 20 -> 29