Class Deque<T>Internal

Deque. Implemented with a doubly linked list.

Type Parameters

  • T

    Type of deque values.

Hierarchy

  • Deque

Constructors

Properties

head?: Node<T>
maxSize: number

The maximum size of the deque.

size: number

The size of the deque.

tail?: Node<T>

Methods

  • Peeks at the first value.

    Returns undefined | T

    The first value or undefined if the deque is empty.

  • Peeks at the last value.

    Returns undefined | T

    The last value or undefined if the deque is empty.

  • Pops a value from the deque.

    Returns undefined | T

    The popped value or undefined if the deque is empty.

  • Appends a value to the deque.

    Parameters

    • value: T

      Value to append.

    Returns number

    The new size of the queue.

  • Shifts a value from the deque.

    Returns undefined | T

    The shifted value or undefined if the deque is empty.

  • Prepends a value to the deque.

    Parameters

    • value: T

      Value to prepend.

    Returns number

    The new size of the queue.

Generated using TypeDoc