Crate heap

Source
Expand description

Heap operations on slices

Functionsยง

build
Make xs a heap. f(x,y) is whether x must be nearer to the root than y.
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 whether x must be nearer to the root than y. 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 whether x must be nearer to the root than y. xs being empty is an error.
replace_root
Given a slice xs which is already a heap, replace the root. f(x,y) is whether x must be nearer to the root than y. xs being empty is an error.
sort
Given a slice xs which is already a heap, sort the elements.