• Retrieves the node at the specified index in a singly linked list.

    • Time Complexity: O(n)
    • 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.