Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeapItem ¶
type HeapItem[T constraints.Ordered] struct { Ref T Value any // contains filtered or unexported fields }
type MaxHeap ¶ added in v0.2.3
type MaxHeap[T constraints.Ordered] []T
MaxHeap is a min-heap of ints.
type MaxHeapWithValue ¶
type MaxHeapWithValue[T constraints.Ordered] []*HeapItem[T]
An MaxHeapWithValue is a max-heap of ints.
func (MaxHeapWithValue[T]) Len ¶
func (h MaxHeapWithValue[T]) Len() int
func (MaxHeapWithValue[T]) Less ¶
func (h MaxHeapWithValue[T]) Less(i, j int) bool
func (MaxHeapWithValue[T]) Swap ¶
func (h MaxHeapWithValue[T]) Swap(i, j int)
type MinHeapInt ¶ added in v0.2.12
type MinHeapInt[T ToInt] []T
func (MinHeapInt[T]) Len ¶ added in v0.2.12
func (h MinHeapInt[T]) Len() int
func (MinHeapInt[T]) Less ¶ added in v0.2.12
func (h MinHeapInt[T]) Less(i, j int) bool
func (MinHeapInt[T]) Swap ¶ added in v0.2.12
func (h MinHeapInt[T]) Swap(i, j int)
type MinHeapWithValue ¶
type MinHeapWithValue[T constraints.Ordered] []*HeapItem[T]
An MinHeapWithValue is a min-heap of ints.
func (MinHeapWithValue[T]) Len ¶
func (h MinHeapWithValue[T]) Len() int
func (MinHeapWithValue[T]) Less ¶
func (h MinHeapWithValue[T]) Less(i, j int) bool
func (MinHeapWithValue[T]) Swap ¶
func (h MinHeapWithValue[T]) Swap(i, j int)
type PrioritItem ¶
type PrioritItem[T any] struct { Value T // The value of the item; arbitrary. Priority int // The priority of the item in the queue. // contains filtered or unexported fields }
An PrioritItem is something we manage in a priority queue.
type PriorityQueue ¶
type PriorityQueue[T any] []*PrioritItem[T]
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue[T]) Len ¶
func (pq PriorityQueue[T]) Len() int
func (PriorityQueue[T]) Less ¶
func (pq PriorityQueue[T]) Less(i, j int) bool
func (*PriorityQueue[T]) Pop ¶
func (pq *PriorityQueue[T]) Pop() any
Pop an item from the priority queue
func (*PriorityQueue[T]) Push ¶
func (pq *PriorityQueue[T]) Push(x any)
Push a new item into the priority queue
func (PriorityQueue[T]) Swap ¶
func (pq PriorityQueue[T]) Swap(i, j int)
func (*PriorityQueue[T]) Update ¶
func (pq *PriorityQueue[T]) Update(item *PrioritItem[T], value T, priority int)
Update modifies the priority and value of an PrioritItem in the queue.
type UniqMinHeap ¶
type UniqMinHeap[T constraints.Ordered] struct { // contains filtered or unexported fields }
An UniqMinHeap is a min-heap of ints.
func NewUniqMinHeap ¶
func NewUniqMinHeap[T constraints.Ordered]() UniqMinHeap[T]
func (UniqMinHeap[T]) Len ¶
func (h UniqMinHeap[T]) Len() int
func (UniqMinHeap[T]) Less ¶
func (h UniqMinHeap[T]) Less(i, j int) bool
func (UniqMinHeap[T]) Swap ¶
func (h UniqMinHeap[T]) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.