container

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparabler

type Comparabler interface {
	Interface
}

Comparabler types that can be compared, with base types(todo)

type Float

type Float interface {
	~float32 | ~float64
}

Float float32 & float64

type InnerType

type InnerType interface {
	Integer | Float | String
}

InnerType all golang base type

type Integer

type Integer interface {
	Signed | Unsigned
}

Integer Signed & Unsigned

type Interface

type Interface interface {
	Less(a any) bool
}

Interface types that can be compared

type PriorityQueue

type PriorityQueue struct {
	// contains filtered or unexported fields
}

PriorityQueue priority queue based container/heap

func InitPq

func InitPq(comps ...Comparabler) (pq *PriorityQueue)

InitPq initial a priority queue instance

func (*PriorityQueue) Empty added in v1.0.1

func (pq *PriorityQueue) Empty() bool

Empty

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

Len implement heap interface

func (*PriorityQueue) Less

func (pq *PriorityQueue) Less(i, j int) bool

Less implement heap interface

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop implement heap interface

func (*PriorityQueue) Popx

func (pq *PriorityQueue) Popx() (x Comparabler)

Popx pop a element from priority queue, removes and returns the top element

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push implement heap interface

func (*PriorityQueue) Pushx

func (pq *PriorityQueue) Pushx(x Comparabler)

Pushx push a element into priority queue

func (*PriorityQueue) Swap

func (pq *PriorityQueue) Swap(i, j int)

Swap implement heap interface

func (*PriorityQueue) Topx

func (pq *PriorityQueue) Topx() (x Comparabler)

Top returns the top element but don't remove

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

Signed is a constraint that permits any signed integer type.

type String

type String interface {
	~string | ~byte
}

String string & byte

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Unsigned is a constraint that permits any unsigned integer type.

Jump to

Keyboard shortcuts

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