/** * A simple queue implementation using an array. * This implementation optimizes for O(1) enqueue and dequeue operations * by avoiding array shifts, which are O(n). * * Usage: * ```ts * const queue = new ArrayQueue(); * queue.enqueue(1); * queue.enqueue(2); * console.log(queue.dequeue()); // 1 * console.log(queue.size()); // 1 * console.log(queue.isEmpty()); // false * queue.dequeue(); * console.log(queue.isEmpty()); // true * ``` */ export declare class ArrayQueue { private items; private headIndex; /** * size is the difference between the actual array length and the index offset * @returns the number of items in the queue */ size(): number; /** * isEmpty checks if the queue has no items * @returns true if the queue is empty */ isEmpty(): boolean; /** * enqueue adds an item to the end of the queue * O(1) - Push to the end is highly optimized in V8. */ enqueue(data: T): void; /** * dequeue removes and returns the item at the front of the queue * O(1) - Avoids array shifting by incrementing the index. * @returns the item at the front of the queue or undefined if the queue is empty */ dequeue(): T | undefined; } //# sourceMappingURL=queue.d.ts.map