Module pythonnds.dequeue

In computer science, a double-ended queue is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front or back. It is also often called a head-tail linked list, though properly this refers to a specific data structure implementation of a deque.

Classes

class DeQueue

Methods

def addFirst(self, value: ~T) ‑> NoneType

Add element to dequeue at head end

def addLast(self, value: ~T) ‑> NoneType

Add element to dequeue at tail end

def getFirst(self) ‑> ~T

View first element in the dequeue.

def getLast(self)

View last element in the dequeue.

def getSize(self) ‑> int

Get size of the queue.

def isEmpty(self) ‑> bool

Check if queue is empty.

def pollFirst(self) ‑> ~T

Remove element from the queue at head.

def pollLast(self) ‑> ~T

Remove element from the queue at tail.

class Node (value: ~T)