Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binomial ¶
Binomial is a binomial queue
Example ¶
b := NewBinomial[int]() b.Push(1) b.Push(9) b.Push(9) b.Push(7) b2 := NewBinomial[int]() b2.Push(13) b2.Push(11) b.Merge(b2) for b.Size() > 0 { fmt.Print(b.Pop(), ",") }
Output: 1,7,9,9,11,13,
func NewBinomial ¶
NewBinomial return a binomial queue with default capacity
type Fixable ¶
type Fixable[P cmp.Ordered, V comparable] struct { Paired[P, V] }
Example ¶
pq := NewFixable[int, string](3) pq.PushPair(1, "1") pq.PushPair(9, "9") pq.PushPair(9, "9") pq.PushPair(7, "7") for pq.Size() > 0 { fmt.Print(pq.Pop()) } fmt.Println() pq.PushPair(100, "1") pq.PushPair(9, "9") pq.PushPair(9, "9") pq.PushPair(7, "7") pq.PushPair(0, "x") pq.Del("x") pq.Fix(1, "1") for pq.Size() > 0 { fmt.Print(pq.Pop()) }
Output: 1799 1799
func NewFixable ¶
func NewFixable[P cmp.Ordered, V comparable](cap uint) *Fixable[P, V]
type Leftist ¶
Example ¶
b := NewLeftist[int]() b.Push(1) b.Push(9) b.Push(9) b.Push(7) b2 := NewLeftist[int]() b2.Push(13) b2.Push(11) b.Merge(b2) for b.Size() > 0 { fmt.Print(b.Pop(), ",") }
Output: 1,7,9,9,11,13,
func NewLeftist ¶
type Paired ¶
type PriorQueue ¶
Click to show internal directories.
Click to hide internal directories.