Documentation ¶
Index ¶
- Variables
- type PriorityQueue
- func (pq *PriorityQueue[T]) Dequeue() (T, error)
- func (pq *PriorityQueue[T]) Enqueue(item T) error
- func (pq *PriorityQueue[T]) Len() int
- func (pq *PriorityQueue[T]) Less(i, j int) bool
- func (pq *PriorityQueue[T]) Pop() interface{}
- func (pq *PriorityQueue[T]) Push(x interface{})
- func (pq *PriorityQueue[T]) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOutOfCapacity = errors.New("out of capacity")
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue[T any] struct { // contains filtered or unexported fields }
func NewPriorityQueue ¶
func NewPriorityQueue[T any](capacity int, less func(a, b T) bool) *PriorityQueue[T]
func (*PriorityQueue[T]) Dequeue ¶
func (pq *PriorityQueue[T]) Dequeue() (T, error)
func (*PriorityQueue[T]) Enqueue ¶
func (pq *PriorityQueue[T]) Enqueue(item T) error
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() interface{}
func (*PriorityQueue[T]) Push ¶
func (pq *PriorityQueue[T]) Push(x interface{})
func (*PriorityQueue[T]) Swap ¶
func (pq *PriorityQueue[T]) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.