LinkedQueue
Container of elements that are inserted and removed according to the FIFO principle. This structure is based on SinglyLinkedList.
new LinkedQueue()
/**
* Creates an instance of LinkedQueue.
*
* @param elements List of elements to create the new queue with.
*/
constructor(elements: T[] = [])length
length: numberExamples:
import { LinkedQueue } from 'ads-js/queues';
const queue = new LinkedQueue();
queue.length === 0; // true
queue.enqueue(1);
queue.length === 1; // trueclear()
dequeue()
enqueue()
getFirst()
isEmpty()
Returns:
Examples:
Last updated