Expand description
Some heap operations on slice.
Functionsยง
- heap_
pop - Move the smallest element to the tail of the heap.
- heap_
pop_ by - Just like
heap_pop
, but with a compare function. - heap_
push - Gives a heap slice, which contains a new element in the tail, using
heap_push
function to extend the heap to include the tail element. Default heap is smallest heap. - heap_
push_ by - Just like
heap_push
, but with a compare function to indicate the order of the heap. - heap_
sort - Using heap sort algorithm
- heapify
- To construct a heap from a slice; default heap is smallest heap.
- n_
smallest - Get the
n
smallest element from a slice, when n > len, return None.