Documentation ¶
Overview ¶
Package heap provides an implementation of priority queue structure in Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue[T any] struct { // contains filtered or unexported fields }
PriorityQueue represents a priority queue.
func NewFunc ¶
func NewFunc[T any](less algorithm.LessFunc[T]) *PriorityQueue[T]
NewNewFunc creates a new priority queue of T using Less function.
func (*PriorityQueue[T]) Empty ¶
func (s *PriorityQueue[T]) Empty() bool
Empty returns whether the queue is empty or not.
func (*PriorityQueue[T]) Len ¶
func (h *PriorityQueue[T]) Len() int
Size returns the size of the queue.
func (*PriorityQueue[T]) Push ¶
func (h *PriorityQueue[T]) Push(value T)
Push pushes a value into the queue.
func (*PriorityQueue[T]) Top ¶
func (h *PriorityQueue[T]) Top() T
Top returns the value at the top of the queue.
Click to show internal directories.
Click to hide internal directories.