Class DoublyLinkedList<T>

Class representing a doubly linked list. A doubly linked list allows traversal in both forward and backward directions.

Type Parameters

  • T

    The type of values stored in the list.

Constructors

Methods

  • Retrieves the value at a specified index. Optimizes traversal by determining whether to start from the head or tail based on the index.

    Parameters

    • index: number

      The index of the value to retrieve.

    Returns T

    • The value at the specified index, or null if out of bounds.
  • Searches for a value in the list. Traverses from the head to the tail and returns true upon finding the value.

    Parameters

    • value: T

      The value to search for.

    Returns boolean

    • True if the value is found, otherwise false.