Expand description
Heap operations on slices
Functionsยง
- build
- Make
xs
a heap.f(x,y)
is whetherx
must be nearer to the root thany
. - is_heap
- pop
- Given a slice
xs
which is already a heap, move the root to the end of the slice and retract the heap to exclude it.f(x,y)
is whetherx
must be nearer to the root thany
.xs
being empty is an error. - push
- Given a slice
xs
which is all but the last element already a heap, extend the heap to include the last element.f(x,y)
is whetherx
must be nearer to the root thany
.xs
being empty is an error. - replace_
root - Given a slice
xs
which is already a heap, replace the root.f(x,y)
is whetherx
must be nearer to the root thany
.xs
being empty is an error. - sort
- Given a slice
xs
which is already a heap, sort the elements.