Abstract Linked Lists - v1.0.4
    Preparing search index...
    • Retrieves the node at the specified index in a doubly linked list.

      Optimizes traversal by starting from head or tail based on index position.

      • Time Complexity: O(min(index, n - index)) - traverses from nearest end.
      • Space Complexity: O(1)

      Type Parameters

      Parameters

      • instance: L

        The list instance.

      • index: number

        The zero-based index of the node to retrieve.

      Returns undefined | NonNullable<L["head"]>

      The node at the specified index, or undefined if the index is out of bounds.