package
Version:
v0.0.0-...-cb92b4e
Opens a new window with list of versions in this module.
Published: Sep 24, 2023
License: MPL-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
Documentation
¶
-
func Peek[E any, S ~[]E](h S) E
-
func Pop[E constraints.Ordered, S ~[]E](h S) (E, S)
-
func PopFunc[E any, S ~[]E](h S, lt func(a, b E) bool) (E, S)
-
func Push[E constraints.Ordered, S ~[]E](h S, x E) S
-
func PushFunc[E any, S ~[]E](h S, x E, lt func(a, b E) bool) S
-
type Heap
func Peek[E any, S ~[]E](h S) E
Peek returns the lowest element of h.
h is not modified
func PopFunc[E any, S ~[]E](h S, lt func(a, b E) bool) (E, S)
PopFunc removes the minimum element from h and returns it and
an updated S.
PushFunc adds x to the heap h
func PushFunc[E any, S ~[]E](h S, x E, lt func(a, b E) bool) S
type Heap[T any] struct {
}
Heap is a min heap of Ts
func (h *Heap[T]) Peek() (ret T)
Peek returns the minimum element of the heap without removing it.
func (h *Heap[T]) Pop() (ret T)
Pop removes the minimum element from the heap and returns it.
func (h *Heap[T]) Push(x T)
Push adds an element to the heap
Source Files
¶
Click to show internal directories.
Click to hide internal directories.