/**
* Removes the first element from the front of the queue and returns it.
* Throws an error if the queue is empty.
*
* @returns Removed element.
*/
dequeue(): T;
dequeLast()
/**
* Removes the last element from the rear of the queue and returns it. Throws an error if the queue is empty.
*
* @returns Removed element.
*/
dequeueLast(): T;
enqueue()
/**
* Adds element at the rear of the queue.
*
* @param element Element to add.
*/
enqueue(element: T): void;
enqueueFirst()
/**
* Adds element at the front of the queue.
*
* @param element Element to add.
*/
enqueueFirst(element: T): void;
getFirst()
/**
* Gets element from the front of the queue without its removal.
*
* @returns Queue element.
*/
getFirst(): T;
getLast()
/**
* Gets element from the rear of the queue without its removal.
*
* @returns Queue element.
*/
getLast(): T;
isEmpty()
isEmpty(): boolean
Running time O(1)
Checks whether the queue is empty or not.
Returns:
TRUE if the queue is empty, FALSE otherwise.
Examples:
import { LinkedDeque } from 'ads-js/queues';
const queue = new LinkedDeque();
queue.isEmpty(); // true
queue.enqueue(1);
queue.isEmpty(); // false