package
Version:
v0.0.0-...-d7ca37d
Opens a new window with list of versions in this module.
Published: May 27, 2024
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Queue[T any] struct {
}
Queue std::priority_queue
func New[T any](slicePtr *[]T, less func(a, b T) bool) *Queue[T]
New PriorityQueue
slicePtr can be nil, then it will be initialized as []T{}
less can't be nil, it's the compare function
less(i, j int) { return a[i]<b[i] } is min-heap
func (q Queue[T]) Pop() T
Pop priority_queue.pop() with result
func (q Queue[T]) Push(x T)
Push priority_queue.push(x)
func (q Queue[T]) Top() T
Top slice[0]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.