MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / push

Method push

Data-Structures/Heap/KeyPriorityQueue.js:45–49  ·  view source on GitHub ↗

* Adds an element to the queue * @param {*} key * @param {number} priority

(key, priority)

Source from the content-addressed store, hash-verified

43 * @param {number} priority
44 */
45 push(key, priority) {
46 this._heap.push(key)
47 this.priorities.set(key, priority)
48 this._shiftUp(this._heap.length - 1)
49 }
50
51 /**
52 * Removes the element with least priority

Callers 6

PrimMSTMethod · 0.95
updateMethod · 0.95
heapReverseMethod · 0.45
insertMethod · 0.45
BinaryHeap.test.jsFile · 0.45

Calls 2

_shiftUpMethod · 0.95
setMethod · 0.45

Tested by

no test coverage detected