This inherits from LinkedList with two extra properties for a rear node and max length.

It also implements common actions on queues such as enqueue and dequeue.

Type Parameters

  • T

    The type of the satellite data.

Hierarchy

Constructors

Properties

head: null | LLNode<T>

The head (first LLNode node) of the linked list. This node is the first node encountered in LinkedList.traverse traversals.

length: number = 0

The number of nodes in the linked list.

maxLength: null | number

The maximum number of items in the queue at any given time.

If null, there will be no restriction to the number of items.

rear: LLNode<T>

Represents the last item in the queue.

This value changes when enqueue is called.

Methods

  • Places a new value in the queue.

    This inserts a new LLNode after the current rear.

    To enqueue at an arbitrary position in the queue, see LinkedList.insert

    Throws

    Throws when trying to add to a full queue.

    Parameters

    • value: T

      The value to enqueue.

    Returns void

  • Inserts a value into the linked list.

    Todo

    Implement default behaviour to create set the new node as the new head as default behaviour when no insertAfter is specified.

    Parameters

    • nodeValue: T

      The satellite data of the new node to be inserted.

    • insertAfter: LLNode<T>

      The LLNode after which to insert the new value.

    Returns void

  • Traverses the linked list, returning an array representation of the LL, starting from the LinkedList.head head.

    Returns an empty array when LinkedList.head head is null.

    Returns

    The traversal of the linked list.

    Returns T[]

Generated using TypeDoc