import * as utils from '../../utils'; declare class LinkedList implements Iterable { private list; private equalsF; /** * Creates a LinkedList - O(1) * @param equalsFunction equal function for for non-primitive values. */ constructor(equalsFunction?: utils.EqualsFunction); /***************************************************************************** INSPECTION *****************************************************************************/ /** * Returns size - O(1) * @return {number} */ size(): number; /** * Returns true if inked list is empty, false otherwise - O(1) * @return {number} */ isEmpty(): boolean; /***************************************************************************** INSERTION *****************************************************************************/ /** * Adds node to the head of the linked list - O(1) * @param {T} val - value to add to list * @return {void} */ addFront(val: T): boolean; /** * Adds node to the tail of the linked list - O(1) * @param {T} - value to add to list * @return {void} */ addBack(val: T): boolean; /** * Adds a node at specified index - O(n) * @param {number} i - index * @param {T} val - value to add to list * @return {void} */ addAt(i: number, val: T): boolean; /***************************************************************************** ACCESSING *****************************************************************************/ /** * Gets the value of head - O(1) * @returns {T} value of head */ peekFront(): T | null; /** * Gets the value of tail - O(1) * @returns {T} value of tail */ peekBack(): T | null; /** * Gets the element at index i - O(n) * @param {number} i - index of element * @returns {T} value of element at index i */ get(i: number): T | null; /***************************************************************************** SEARCHING *****************************************************************************/ /** * Removes the first occurrence of the specified item in the linked list. * @param {T} value - value to search for * @return {number} the index of the first occurence of the element, and -1 * if the element does not exist. */ indexOf(value: T): number; /** * Checks if value is in linked list. * @param {T} value - value to search for * @returns {boolean} */ contains(value: T): boolean; /***************************************************************************** DELETION *****************************************************************************/ /** * Removes head - O(1) * @return {T} - value of removed head */ removeFront(): T | null; /** * Removes tail - O(1) * @return {T} - value of removed head */ removeBack(): T | null; /** * Removes first occurence of node with specified value. Returns true if * removal was successful, and false otherwise. - O(n) * @param {T} val - value to remove * @returns {T} - value of removed node */ remove(val: T): T | null; /** * Removes node at specified index- O(n) * @param {number} i - index to remove * @return {T} - value of removed node */ removeAt(i: number): T | null; /** * Deletes all nodes - O(1) */ clear(): void; /***************************************************************************** HELPERS *****************************************************************************/ /** * Appends values from an array to list - O(k) */ fromArray(A: T[]): LinkedList; [Symbol.iterator](): Iterator; } export default LinkedList; //# sourceMappingURL=linked-list.d.ts.map