Documentation
¶
Overview ¶
Package minheap provides an interface and implementations for the min heap data structure
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayMinHeap ¶
func NewArrayMinHeap ¶
func NewArrayMinHeap[T cmp.Ordered](i ...T) *ArrayMinHeap[T]
NewMinHeap instantiates a min heap and returns a pointer to it. The variadic argument can be used to insert items into the heap after it is created.
func (*ArrayMinHeap[T]) Extract ¶
func (m *ArrayMinHeap[T]) Extract() T
Extract returns the minimum item from the min heap and swaps the elements as necessary to restore the heap property in the data structure.
func (*ArrayMinHeap[T]) Insert ¶
func (m *ArrayMinHeap[T]) Insert(i T)
Insert inserts the item into the min heap.
func (*ArrayMinHeap[T]) Peek ¶
func (m *ArrayMinHeap[T]) Peek() T
func (*ArrayMinHeap[T]) Size ¶
func (m *ArrayMinHeap[T]) Size() int
Click to show internal directories.
Click to hide internal directories.