Discover Packages
github.com/pachyderm/pachyderm/v2
src
internal
stream
heap
package
Version:
v2.7.0-nightly.20230616
Opens a new window with list of versions in this module.
Published: Jun 15, 2023
License: Apache-2.0
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func Peek[E any , S ~[]E](h S) E
Peek returns the lowest element of h.
h is not modified
func Pop[E any , S ~[]E](h S, lt func(a, b E) bool ) (E, S)
Pop removes the minimum element from h and returns it and
an updated S.
func Push[E any , S ~[]E](h S, x E, lt func(a, b E) bool ) S
Push adds x to the heap h
type Heap[T any ] struct {
}
Heap is a min-heap, implemented using a slice
New creates a new Heap and returns it.
The heap will use lt for comparisons.
lt must return true if a < b and false otherwise.
lt should be a pure function of a and b, and should not retain either after it returns.
func (h *Heap [T]) Peek() (ret T, exists bool )
func (h *Heap [T]) Pop() (ret T, exists bool )
func (h *Heap [T]) Push(x T)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.