struct IntHeap
pub struct IntHeap {
pub a []int
pub n int
}Purpose
Structure encapsulating a, n.
Public fields
a[]int- field ([]int)
nint- count, length, or limit
#container/heapIntHeap / StrHeap min-heaps.
struct IntHeappub struct IntHeap {
pub a []int
pub n int
}Structure encapsulating a, n.
a []intn intstruct StrHeappub struct StrHeap {
pub a []string
pub n int
}Structure encapsulating a, n.
a []stringn intnew_intspub fn new_ints() IntHeapConstruct ints.
No arguments are required.
IntHeap — a value of this type
new_strspub fn new_strs() StrHeapConstruct strs.
No arguments are required.
StrHeap — a value of this type
from_intspub fn from_ints(xs []int) IntHeapBuild from ints.
xs []intIntHeap — a value of this type
from_strspub fn from_strs(xs []string) StrHeapBuild from strs.
xs []stringStrHeap — a value of this type
len_intspub fn len_ints(h &IntHeap) intLen int slice.
h &IntHeapint — a value of this type
len_strspub fn len_strs(h &StrHeap) intLen strs.
h &StrHeapint — a value of this type
($&StrHeap) initpub fn (h $&StrHeap) init()Initialize internal state and default parameters.
h $&StrHeapStrHeap instance used by this call (exclusive borrow).This call does not return a value.
($&IntHeap) initpub fn (h $&IntHeap) init()Initialize internal state and default parameters.
h $&IntHeapIntHeap instance used by this call (exclusive borrow).This call does not return a value.
($&IntHeap) pushpub fn (h $&IntHeap) push(x int)Execute push on $&IntHeap.
h $&IntHeapIntHeap instance used by this call (exclusive borrow).x intThis call does not return a value.
($&IntHeap) poppub fn (h $&IntHeap) pop() intExecute pop on $&IntHeap. Throws on failure; handle the error or propagate it to the caller.
h $&IntHeapIntHeap instance used by this call (exclusive borrow).int — a value of this type
($&StrHeap) pushpub fn (h $&StrHeap) push(x string)Execute push on $&StrHeap.
h $&StrHeapStrHeap instance used by this call (exclusive borrow).x stringThis call does not return a value.
($&StrHeap) poppub fn (h $&StrHeap) pop() stringExecute pop on $&StrHeap. Throws on failure; handle the error or propagate it to the caller.
h $&StrHeapStrHeap instance used by this call (exclusive borrow).string — result string