()
| 48 | return this.size(); |
| 49 | } |
| 50 | pop() { |
| 51 | const poppedValue = this.peek(); |
| 52 | const bottom = this.size() - 1; |
| 53 | if (bottom > 0) { |
| 54 | this._swap(0, bottom); |
| 55 | } |
| 56 | this._heap.pop(); |
| 57 | this._siftDown(); |
| 58 | return poppedValue; |
| 59 | } |
| 60 | replace(value) { |
| 61 | const replacedValue = this.peek(); |
| 62 | this._heap[0] = value; |