Class Deque<T>Internal

Deque. Implemented with a doubly linked list.

Type Parameters

  • T

    Type of deque data.

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 data.

    Returns undefined | T

    The first data or undefined if the deque is empty.

  • Peeks at the last data.

    Returns undefined | T

    The last data or undefined if the deque is empty.

  • Pops data from the deque.

    Returns undefined | T

    The popped data or undefined if the deque is empty.

  • Appends data to the deque.

    Parameters

    • data: T

      Data to append.

    Returns number

    The new size of the queue.

  • Shifts data from the deque.

    Returns undefined | T

    The shifted data or undefined if the deque is empty.

  • Prepends data to the deque.

    Parameters

    • data: T

      Data to prepend.

    Returns number

    The new size of the queue.

Generated using TypeDoc