utils

package
v0.0.0-...-0695b8e Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsInt

func AbsInt(x int) int

Types

type Item

type Item[T any] struct {
	Value    T
	Priority int
	// contains filtered or unexported fields
}

type MaxHeap

type MaxHeap[T any] struct {
	PriorityQueue[T]
}

func NewMaxHeap

func NewMaxHeap[T any]() *MaxHeap[T]

func (*MaxHeap[T]) Less

func (mh *MaxHeap[T]) Less(i, j int) bool

type MinHeap

type MinHeap[T any] struct {
	PriorityQueue[T]
}

func NewMinHeap

func NewMinHeap[T any]() *MinHeap[T]

func (*MinHeap[T]) Less

func (mh *MinHeap[T]) Less(i, j int) bool

type PriorityQueue

type PriorityQueue[T any] []*Item[T]

func (PriorityQueue[T]) Len

func (pq PriorityQueue[T]) Len() int

func (*PriorityQueue[T]) Pop

func (pq *PriorityQueue[T]) Pop() any

func (*PriorityQueue[T]) Push

func (pq *PriorityQueue[T]) Push(x any)

func (PriorityQueue[T]) Swap

func (pq PriorityQueue[T]) Swap(i, j int)

Jump to

Keyboard shortcuts

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