MCPcopy
hub / github.com/yangshun/lago / enqueue

Method enqueue

src/data-structures/Queue.ts:23–33  ·  view source on GitHub ↗

* Adds an element to the back of the Queue. * @param {*} element * @return {number} The new length of the Queue.

(value: T)

Source from the content-addressed store, hash-verified

21 * @return {number} The new length of the Queue.
22 */
23 enqueue(value: T): number {
24 const node = new Node(value);
25 const prevLast = this._dummyTail.prev as Node<T> | DummyHeadNode;
26 prevLast.next = node;
27
28 node.prev = prevLast;
29 node.next = this._dummyTail;
30 this._dummyTail.prev = node;
31 this._length++;
32 return this._length;
33 }
34
35 /**
36 * Removes the element at the front of the Queue.

Callers 5

breadthFirstSearchFunction · 0.95
topologicalSortFunction · 0.95
Deque.test.tsFile · 0.45
Queue.test.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected