Commit 251c091
committed
Adds
Introduces efficient "heapify" algorithm for converting an unsorted list
to a heap-sorted list, using it for the `of` constructor, and after a
large `addAll` operation, when it's presumed faster than just bubbling
down all the new elements.
Also rewrites `HeapPriorityQueue` to use a growable list as backing
array, instead of implementing the same thing using the double-when-full
algorithm, and still having to deal with nullable cells.
The platform growable list implementation is assumed to efficiently
avoid some of those `null` checks.[Heap]PriorityQueue.of constructor.1 parent 29b8869 commit 251c091
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
329 | 331 | | |
330 | 332 | | |
331 | 333 | | |
| |||
407 | 409 | | |
408 | 410 | | |
409 | 411 | | |
410 | | - | |
| 412 | + | |
411 | 413 | | |
412 | 414 | | |
413 | 415 | | |
| |||
0 commit comments