Heapify up from the given index in the heap and make sure everything is correct. Stops when the child value is in correct order with its parent. @param i the index in the heap to start checking from.
(int i)
| 270 | * @param i the index in the heap to start checking from. |
| 271 | */ |
| 272 | private void heapifyUp(int i) |
| 273 | { |
| 274 | int iP = parent(i); |
| 275 | while(i != 0 && cmp(i, iP) < 0)//Should not be greater then our parent |
| 276 | { |
| 277 | swapHeapValues(iP, i); |
| 278 | i = iP; |
| 279 | iP = parent(i); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Swaps the values stored in the heap for the given indices |
no test coverage detected