Help us shape the future of Go! Take the 2026 Go Developer Survey

structs

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 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 CompareFunc

type CompareFunc func(a Item, b Item) bool

CompareFunc is a function to sort nodes in a queue

type Item

type Item interface {
	DeepCopy() Item
	Equals(Item) bool
}

Item is an interface for the nodes to be stored in a queue

type IteratorFunc

type IteratorFunc func(Item)

IteratorFunc is a function to be used for each item in the queue

type SortedUniqueList

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

SortedUniqueList is a kind of priority queues, whose nodes are sorted Also, uniqueness of the node is guaranteed

func NewSortedUniqueQueue

func NewSortedUniqueQueue(compareFunc CompareFunc) *SortedUniqueList

NewSortedUniqueQueue is a constructor for the SortedUniqueList

func (*SortedUniqueList) Add

func (q *SortedUniqueList) Add(item Item)

Add a node to the SortedUniqueList

func (*SortedUniqueList) Delete

func (q *SortedUniqueList) Delete(i Item)

Delete deletes a node from the queue

func (*SortedUniqueList) First

func (q *SortedUniqueList) First() Item

First retrieves the first node in the queue

func (*SortedUniqueList) ForEach

func (q *SortedUniqueList) ForEach(iteratorFunc IteratorFunc)

ForEach runs IteratorFunc for each item in the queue

func (*SortedUniqueList) Len

func (q *SortedUniqueList) Len() int

Len returns the length of the queue

Jump to

Keyboard shortcuts

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