Transform list into a maxheap, in-place, in O(len(x)) time.
(x)
| 209 | return item |
| 210 | |
| 211 | def heapify_max(x): |
| 212 | """Transform list into a maxheap, in-place, in O(len(x)) time.""" |
| 213 | n = len(x) |
| 214 | for i in reversed(range(n//2)): |
| 215 | _siftup_max(x, i) |
| 216 | |
| 217 | |
| 218 | # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos |
no test coverage detected