MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / heapifyUp

Method heapifyUp

JSAT/src/jsat/utils/IntPriorityQueue.java:272–281  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

offerMethod · 0.95

Calls 3

parentMethod · 0.95
cmpMethod · 0.95
swapHeapValuesMethod · 0.95

Tested by

no test coverage detected