export declare class LinkedList implements Iterable> { private _head; private _tail; private _size; /** * Adds a node with the specified value to the end of the list. * * @param value The value of the node to add. * * @timeComplexity `O(1)` * * @returns The newly added node. */ append(value: T): ListNode; /** * Adds a node with the specified value to the end of the list. * * @param value The value of the node to add. * * @timeComplexity `O(1)` * * @returns The newly added node. */ prepend(value: T): ListNode; /** * Removes a node from the list. * * @param node The node to remove. * * @timeComplexity `O(1)` * * @returns True if the node is deleted, otherwise false. */ deleteNode(node: ListNode): boolean; /** * Adds a node with the specified value after a given node. * * @param afterNode The node after which the new node should be added. * @param value The value of the new node. * * @timeComplexity `O(1)` * * @returns The newly added node. */ insertAfter(afterNode: ListNode, value: T): ListNode; /** * Adds a node with the specified value before a given node. * * @param beforeNode The node before which the new node should be added. * @param value The value of the new node. * * @timeComplexity `O(1)` * * @returns The newly added node. */ insertBefore(beforeNode: ListNode, value: T): ListNode; /** * Finds a node with a specific value. * * @param value The value of the node to find. * * @timeComplexity `O(n)` * * @returns The node with the specified value or undefined if not found. */ find(value: T): ListNode | void; /** * Clones the linked list. * * @timeComplexity `O(n)` * * @returns A new linked list that is a clone of the current list. */ clone(): LinkedList; /** * Removes all nodes from the list. * * Note: For efficiency, this doesn't delete nodes one by one. * Avoid reusing the old nodes to avoid unexpected behaviors. * * @timeComplexity `O(1)` */ clear(): void; /** * Returns the number of nodes in the list. * * @timeComplexity `O(1)` */ size(): number; /** * Returns whether the list is empty. * * @timeComplexity `O(1)` */ isEmpty(): boolean; /** * Converts the linked list to an array. * * @timeComplexity `O(n)` * * @returns An array containing all the values in the list. */ toArray(): ListNode[]; /** * Returns the head node of the list. * * @timeComplexity `O(1)` * * @returns The head node or undefined if the list is empty. */ head(): ListNode | undefined; /** * Returns the tail node of the list. * * @timeComplexity `O(1)` * * @returns The tail node or undefined if the list is empty. */ tail(): ListNode | undefined; /** * Creates a linked list from an array of values. * * @param array The array of values to convert into a linked list. * * @timeComplexity `O(n)` * * @returns A new linked list containing the values from the array. */ static fromArray(array: T[]): LinkedList; values(): IterableIterator>; [Symbol.iterator](): IterableIterator>; } export declare class ListNode { value: T; private _next; private _prev; private _isDisposed; constructor(value: T); /** * Get the node after this node. * * @timeComplexity `O(1)` * * @returns A node, or undefined if this node has no next node. */ next(): ListNode | undefined; /** * Get the node before this node. * * @timeComplexity `O(1)` * * @returns A node, or undefined if this node has no previous node. */ prev(): ListNode | undefined; /** * Check if the node is already disposed. * * @timeComplexity `O(1)` * * @returns A boolean indicating whether the node is disposed or not. */ isDisposed(): boolean; /** * Change the next node of this node. * * For internal use only. * * @timeComplexity `O(1)` */ setNext(next: ListNode | undefined): void; /** * Change the previous node of this node. * * For internal use only. * * @timeComplexity `O(1)` */ setPrev(prev: ListNode | undefined): void; /** * Dispose this node. * * For internal use only. * * @timeComplexity `O(1)` */ dispose(): void; }