Removes the node specified from the heap @param i the valid heap node index to remove from the heap @return the value that was stored in the heap node
(int i)
| 319 | * @return the value that was stored in the heap node |
| 320 | */ |
| 321 | protected int removeHeapNode(int i) |
| 322 | { |
| 323 | int val = heap[i]; |
| 324 | int rightMost = --size; |
| 325 | heap[i] = heap[rightMost]; |
| 326 | heap[rightMost] = 0; |
| 327 | if(fastValueRemove == Mode.HASH) |
| 328 | { |
| 329 | valueIndexMap.remove(val); |
| 330 | if(size != 0) |
| 331 | valueIndexMap.put(heap[i], i); |
| 332 | } |
| 333 | else if(fastValueRemove == Mode.BOUNDED) |
| 334 | { |
| 335 | valueIndexStore[val] = -1; |
| 336 | } |
| 337 | heapDown(i); |
| 338 | return val; |
| 339 | } |
| 340 | |
| 341 | private int rightChild(int i) |
| 342 | { |