priority

package
v0.33.5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package priority provides priority queue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Value    string // The value of the item; arbitrary.
	Priority int64  // The priority of the item in the queue.
	// contains filtered or unexported fields
}

An Item is something we manage in a priority queue.

type Queue

type Queue []*Item

A Queue implements heap.Interface and holds Items.

func MakeQueue

func MakeQueue() Queue

MakeQueue allows to create priority queue.

func (Queue) Len

func (pq Queue) Len() int

Len ...

func (Queue) Less

func (pq Queue) Less(i, j int) bool

Less ...

func (*Queue) Pop

func (pq *Queue) Pop() any

Pop value from queue.

func (*Queue) Push

func (pq *Queue) Push(x any)

Push value into queue.

func (Queue) Swap

func (pq Queue) Swap(i, j int)

Swap ...

Jump to

Keyboard shortcuts

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