-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Labels
Description
DataStructures.jl/src/heaps/arrays_as_heaps.jl
Lines 44 to 65 in c86628e
| """ | |
| heappop!(v, [ord]) | |
| Given a binary heap-ordered array, remove and return the lowest ordered element. | |
| For efficiency, this function does not check that the array is indeed heap-ordered. | |
| """ | |
| function heappop!(xs::AbstractArray, o::Ordering=Forward) | |
| x = xs[1] | |
| y = pop!(xs) | |
| if !isempty(xs) | |
| percolate_down!(xs, 1, y, o) | |
| end | |
| return x | |
| end | |
| """ | |
| heappush!(v, x, [ord]) | |
| Given a binary heap-ordered array, push a new element `x`, preserving the heap property. | |
| For efficiency, this function does not check that the array is indeed heap-ordered. | |
| """ | |
| @inline function heappush!(xs::AbstractArray, x, o::Ordering=Forward) |
these are not rendered in the docs apparently.