priorityqueue

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package heap provides an implementation of priority queue structure in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue[T any] struct {
	// contains filtered or unexported fields
}

PriorityQueue represents a priority queue.

func New

func New[T cmp.Ordered]() *PriorityQueue[T]

New creates a new priority queue of T.

func NewFunc

func NewFunc[T any](less algorithm.LessFunc[T]) *PriorityQueue[T]

NewNewFunc creates a new priority queue of T using Less function.

func (*PriorityQueue[T]) Empty

func (s *PriorityQueue[T]) Empty() bool

Empty returns whether the queue is empty or not.

func (*PriorityQueue[T]) Len

func (h *PriorityQueue[T]) Len() int

Size returns the size of the queue.

func (*PriorityQueue[T]) Pop

func (h *PriorityQueue[T]) Pop() T

Pop pops a value from the queue.

func (*PriorityQueue[T]) Push

func (h *PriorityQueue[T]) Push(value T)

Push pushes a value into the queue.

func (*PriorityQueue[T]) Top

func (h *PriorityQueue[T]) Top() T

Top returns the value at the top of the queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL