structure

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

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

func NewHeap

func NewHeap() *Heap

NewHeap 创建一个小顶堆

func (*Heap) Len

func (h *Heap) Len() int

Len

func (*Heap) Pop

func (h *Heap) Pop() *Item

func (*Heap) Push

func (h *Heap) Push(item *Item) bool

func (*Heap) Remove

func (h *Heap) Remove(idx int) *Item

func (*Heap) Set

func (h *Heap) Set(k int, i *Item)

Set

func (*Heap) SetLessFn

func (h *Heap) SetLessFn(less lessFn)

SetLessFn

func (*Heap) SetPosFn

func (h *Heap) SetPosFn(setPos setPosFn)

SetPosFn

func (*Heap) Take

func (h *Heap) Take(idx ...int) *Item

type Item

type Item struct {
	Value interface{} // The value of the item; arbitrary.
	// contains filtered or unexported fields
}

An Item is something we manage in a priority queue.

func (*Item) Index

func (item *Item) Index() int

Index

type Ms

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

func NewMs

func NewMs() *Ms

NewMs 创建一个队列

func (*Ms) Append

func (m *Ms) Append(items ...interface{}) int

func (*Ms) Clear

func (m *Ms) Clear()

func (*Ms) Contains

func (m *Ms) Contains(item interface{}) bool

func (*Ms) Delete

func (m *Ms) Delete(idx int) interface{}

func (*Ms) Iterator

func (m *Ms) Iterator(fn func(item interface{}) (bool, error))

func (*Ms) Len

func (m *Ms) Len() int

func (*Ms) Remove

func (m *Ms) Remove(item interface{}) bool

func (*Ms) Take

func (m *Ms) Take() interface{}

func (*Ms) WithDelEventFn

func (m *Ms) WithDelEventFn(fn MsEventFn) *Ms

func (*Ms) WithInsertEventFn

func (m *Ms) WithInsertEventFn(fn MsEventFn) *Ms

type MsEventFn

type MsEventFn func(ms *Ms, item interface{}, i int)

Jump to

Keyboard shortcuts

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