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

Method pop

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

* Removes the element with least priority * @returns the key of the element with least priority

()

Source from the content-addressed store, hash-verified

53 * @returns the key of the element with least priority
54 */
55 pop() {
56 this._swap(0, this._heap.length - 1)
57 const key = this._heap.pop()
58 this.priorities.delete(key)
59 this._shiftDown(0)
60 return key
61 }
62
63 /**
64 * Checks whether a given key is present in the queue

Callers 5

PrimMSTMethod · 0.95
heapReverseMethod · 0.45
deleteMethod · 0.45
extractTopMethod · 0.45

Calls 3

_swapMethod · 0.95
_shiftDownMethod · 0.95
deleteMethod · 0.45

Tested by

no test coverage detected