Documentation
¶
Overview ¶
Package min heap provides an implementation of a min binary heap.
Index ¶
- type MinHeap
- func (heap *MinHeap[T]) Clear()
- func (heap *MinHeap[T]) Collect() []T
- func (heap *MinHeap[T]) Delete(element T) bool
- func (heap *MinHeap[T]) DeleteTop() T
- func (heap *MinHeap[T]) Empty() bool
- func (heap *MinHeap[T]) Insert(element T)
- func (heap *MinHeap[T]) Len() int
- func (heap *MinHeap[T]) Search(element T) bool
- func (heap *MinHeap[T]) String() string
- func (heap *MinHeap[T]) Top() T
- func (heap *MinHeap[T]) Update(old T, new T) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MinHeap ¶
type MinHeap[T types.Comparable[T]] struct { // contains filtered or unexported fields }
MinHeap an implementation of a max heap based on a slice.
func (*MinHeap[T]) Collect ¶
func (heap *MinHeap[T]) Collect() []T
Collect returns the heap is a slice with no particular ordering.
func (*MinHeap[T]) DeleteTop ¶
func (heap *MinHeap[T]) DeleteTop() T
DeleteTop deletes and returns the element at the top of the heap. Will panic if heap has no top element.
func (*MinHeap[T]) Insert ¶
func (heap *MinHeap[T]) Insert(element T)
Insert insert the element into the heap.
Click to show internal directories.
Click to hide internal directories.