improve documentation
This commit is contained in:
@@ -106,6 +106,12 @@ class MultiwayLongMerger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next power of two that is equal or larger than i.
|
||||||
|
* or more formally: x where x = 2^n and x >= i for n ∈ ℕ and n minimal
|
||||||
|
* @param i some positive integer
|
||||||
|
* @return smallest integer that is a power of two and equal or larger than i
|
||||||
|
*/
|
||||||
private static int nextPowOfTwo(int i) {
|
private static int nextPowOfTwo(int i) {
|
||||||
return Integer.highestOneBit(i - 1) << 1;
|
return Integer.highestOneBit(i - 1) << 1;
|
||||||
}
|
}
|
||||||
@@ -164,22 +170,32 @@ class MultiwayLongMerger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A heap is a tree where the value of the parent is smaller than the value of its children.
|
||||||
* <pre>
|
* <pre>
|
||||||
* 7
|
* 23
|
||||||
* 3
|
|
||||||
* 8
|
|
||||||
* 1
|
|
||||||
* 9
|
|
||||||
* 4
|
|
||||||
* 10
|
|
||||||
* 0
|
|
||||||
* 11
|
|
||||||
* 5
|
|
||||||
* 12
|
|
||||||
* 2
|
|
||||||
* 13
|
* 13
|
||||||
* 6
|
|
||||||
* 14
|
* 14
|
||||||
|
* 9
|
||||||
|
* 37
|
||||||
|
* 24
|
||||||
|
* 77
|
||||||
|
* 5
|
||||||
|
* 44
|
||||||
|
* 35
|
||||||
|
* 93
|
||||||
|
* 7
|
||||||
|
* 29
|
||||||
|
* 27
|
||||||
|
* 31 ┌────────────────────────┬────┐
|
||||||
|
* ┌────┼──────────────┬────┐ │ │
|
||||||
|
* ┌────┬────┐ │ │ │ │ │ │
|
||||||
|
* ┏━━┷━┳━━━━┳━━━━┳━━┷━┳━━┷━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┓
|
||||||
|
* ┃ 5 ┃ 9 ┃ 7 ┃ 13 ┃ 24 ┃ 35 ┃ 27 ┃ 23 ┃ 14 ┃ 37 ┃ 77 ┃ 93 ┃ 29 ┃ 31 ┃
|
||||||
|
* ┗━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━┛
|
||||||
|
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 (array indices)
|
||||||
|
* │ │ │ │ │ │
|
||||||
|
* └────┼────┴────┘ │ │
|
||||||
|
* └──────────────┴────┘
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user