(heap)
| 3048 | return first === undefined ? null : first; |
| 3049 | } |
| 3050 | function pop(heap) { |
| 3051 | var first = heap[0]; |
| 3052 | |
| 3053 | if (first !== undefined) { |
| 3054 | var last = heap.pop(); |
| 3055 | |
| 3056 | if (last !== first) { |
| 3057 | heap[0] = last; |
| 3058 | siftDown(heap, last, 0); |
| 3059 | } |
| 3060 | |
| 3061 | return first; |
| 3062 | } else { |
| 3063 | return null; |
| 3064 | } |
| 3065 | } |
| 3066 | |
| 3067 | function siftUp(heap, node, i) { |
| 3068 | var index = i; |
no test coverage detected