export declare class Node { item: Item; next: Node; } /** * The `Queue` class represents a first-in-first-out (FIFO) * queue of generic items. * It supports the usual enqueue and dequeue * operations, along with methods for peeking at the first item, * testing if the queue is empty, and iterating through * the items in FIFO order. *

* This implementation uses a singly linked list with a static nested class for * linked-list nodes. See {@link LinkedQueue} for the version from the * textbook that uses a non-static nested class. * See {@link ResizingArrayQueue} for a version that uses a resizing array. * The enqueue, dequeue, peek, size, and is-empty * operations all take constant time in the worst case. *

* For additional documentation, see Section 1.3 of * Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. * * @param the generic type of an item in this queue */ export default class Queue implements Iterable { private first; private last; private n; private modCount; constructor(); /** * Returns true if this queue is empty. * * @return `true` if this queue is empty; `false` otherwise */ isEmpty(): boolean; /** * Returns the number of items in this queue. * * @return the number of items in this queue */ size(): number; /** * Returns the item least recently added to this queue. * * @return the item least recently added to this queue * @throws Error if this queue is empty */ peek(): Item; /** * Adds the item to this queue. * * @param tem the item to add */ enqueue(item: Item): void; /** * Removes and returns the item on this queue that was least recently added. * * @return the item on this queue that was least recently added * @throws Error if this queue is empty */ dequeue(): Item; /** * Returns a string representation of this queue. * * @return the sequence of items in FIFO order, separated by spaces */ toString(): string; /** * Returns an iterator that iterates over the items in this queue in FIFO order. * * @return an iterator that iterates over the items in this queue in FIFO order */ [Symbol.iterator](): { next(): IteratorResult; }; }