basic

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinCap = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkQueue

type LinkQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewLinkQueue

func NewLinkQueue[T any]() *LinkQueue[T]

func (*LinkQueue[T]) Peek

func (q *LinkQueue[T]) Peek() *T

func (*LinkQueue[T]) PopFront

func (q *LinkQueue[T]) PopFront() T

func (*LinkQueue[T]) PushBack

func (q *LinkQueue[T]) PushBack(e T)

func (*LinkQueue[T]) Size

func (q *LinkQueue[T]) Size() int

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any](cap int) *Queue[T]

func QueueFrom

func QueueFrom[T any](elems []T) *Queue[T]

func (*Queue[T]) Clone

func (q *Queue[T]) Clone() []T

func (*Queue[T]) Peek

func (q *Queue[T]) Peek() *T

func (*Queue[T]) PopFront

func (q *Queue[T]) PopFront() T

func (*Queue[T]) PushBack

func (q *Queue[T]) PushBack(e T)

func (*Queue[T]) Size

func (q *Queue[T]) Size() int

type Set

type Set[T comparable] map[T]struct{}

func NewSet

func NewSet[T comparable]() Set[T]

func (Set[T]) Add

func (s Set[T]) Add(e T)

func (Set[T]) Clear

func (s Set[T]) Clear()

func (Set[T]) Contains

func (s Set[T]) Contains(e T) bool

func (Set[T]) Drain

func (s Set[T]) Drain() []T

func (Set[T]) Len

func (s Set[T]) Len() int

func (Set[T]) Remove

func (s Set[T]) Remove(e T)

func (Set[T]) TakeOne

func (s Set[T]) TakeOne() T

TakeOne take out an element

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any](c int) *Stack[T]

func (*Stack[T]) Cap

func (s *Stack[T]) Cap() int

func (*Stack[T]) Drain

func (s *Stack[T]) Drain() []T

func (*Stack[T]) Index

func (s *Stack[T]) Index(fn func(T) bool) int

func (*Stack[T]) Iterate

func (s *Stack[T]) Iterate(fn func(T) bool)

func (*Stack[T]) IterateRange

func (s *Stack[T]) IterateRange(lo, hi int, fn func(T) bool)

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

func (*Stack[T]) PeekIndex

func (s *Stack[T]) PeekIndex(i int) T

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(e T)

func (*Stack[T]) Reverse

func (s *Stack[T]) Reverse()

func (*Stack[T]) Size

func (s *Stack[T]) Size() int

func (*Stack[T]) String

func (s *Stack[T]) String() string

type StackCmp

type StackCmp[T comparable] struct {
	Stack[T]
}

func NewStackCmp

func NewStackCmp[T comparable](c int) *StackCmp[T]

func (*StackCmp[T]) Contains

func (s *StackCmp[T]) Contains(e T) bool

type UnionFind

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

func NewUnionFind

func NewUnionFind(numV int) *UnionFind

func (*UnionFind) Find

func (uf *UnionFind) Find(v int) int

func (*UnionFind) IsConnected

func (uf *UnionFind) IsConnected(v1, v2 int) bool

func (*UnionFind) NumConnectedComponent

func (uf *UnionFind) NumConnectedComponent() int

func (*UnionFind) Union

func (uf *UnionFind) Union(v1, v2 int)

Jump to

Keyboard shortcuts

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