collection

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitset

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

func NewBitset

func NewBitset(n int) Bitset

func (Bitset) Bytes

func (b Bitset) Bytes() []byte

func (Bitset) Contains

func (b Bitset) Contains(n int) bool

func (Bitset) Copy

func (b Bitset) Copy() Bitset

func (Bitset) GetLength

func (b Bitset) GetLength() int

func (Bitset) Intersection

func (b Bitset) Intersection(o Bitset) Bitset

func (Bitset) IsZero

func (b Bitset) IsZero() bool

func (Bitset) Union

func (b Bitset) Union(o Bitset) Bitset

func (Bitset) Up

func (b Bitset) Up(n int) Bitset

type BitsetDict

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

func NewBitsetDict

func NewBitsetDict[T any]() *BitsetDict[T]

func (*BitsetDict[T]) Contains

func (d *BitsetDict[T]) Contains(bs Bitset) bool

func (*BitsetDict[T]) Get

func (d *BitsetDict[T]) Get(bs Bitset) (T, bool)

func (*BitsetDict[T]) Set

func (d *BitsetDict[T]) Set(bs Bitset, v T) *BitsetDict[T]

type Deque added in v0.4.0

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

func NewDeque added in v0.4.0

func NewDeque[T any]() *Deque[T]

func (*Deque[T]) Back added in v0.4.0

func (q *Deque[T]) Back() T

func (*Deque[T]) Front added in v0.4.0

func (q *Deque[T]) Front() T

func (*Deque[T]) PopBack added in v0.4.0

func (q *Deque[T]) PopBack()

func (*Deque[T]) PopFront added in v0.4.0

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

func (*Deque[T]) PushBack added in v0.4.0

func (q *Deque[T]) PushBack(x T)

func (*Deque[T]) PushFront added in v0.4.0

func (q *Deque[T]) PushFront(x T)

func (*Deque[T]) Size added in v0.4.0

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

type Pair

type Pair[T, W comparable] struct {
	First  T
	Second W
}

func NewPair

func NewPair[T, W comparable](first T, second W) Pair[T, W]

type PriorityQueue added in v0.4.0

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

Algorithms, 4th Edition https://algs4.cs.princeton.edu/home/

func NewPriorityQueue added in v0.4.0

func NewPriorityQueue[T any](lessFunc func(x, y T) bool) *PriorityQueue[T]

func (*PriorityQueue[T]) IsEmpty added in v0.4.0

func (pq *PriorityQueue[T]) IsEmpty() bool

func (*PriorityQueue[T]) Pop added in v0.4.0

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

func (*PriorityQueue[T]) Push added in v0.4.0

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

func (*PriorityQueue[T]) Size added in v0.4.0

func (pq *PriorityQueue[T]) Size() int

func (*PriorityQueue[T]) Top added in v0.4.0

func (pq *PriorityQueue[T]) Top() T

type Set

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

func NewSet

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

func (*Set[T]) Contains

func (s *Set[T]) Contains(x T) bool

func (*Set[T]) Copy

func (s *Set[T]) Copy() *Set[T]

func (*Set[T]) Difference

func (s *Set[T]) Difference(other *Set[T]) *Set[T]

func (*Set[T]) Erase

func (s *Set[T]) Erase(x T) *Set[T]

func (*Set[T]) Insert

func (s *Set[T]) Insert(x T) *Set[T]

func (*Set[T]) Intersection

func (s *Set[T]) Intersection(other *Set[T]) *Set[T]

func (*Set[T]) Iterator

func (s *Set[T]) Iterator() *setIterator[T]

func (*Set[T]) Size

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

func (*Set[T]) Slice

func (s *Set[T]) Slice() []T

func (*Set[T]) Union

func (s *Set[T]) Union(other *Set[T]) *Set[T]

type Sha

type Sha = [sha256.Size]byte

type UnionFind

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

func NewUnionFind

func NewUnionFind(n int) *UnionFind

func (*UnionFind) Find

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

func (*UnionFind) Group

func (uf *UnionFind) Group() [][]int

func (*UnionFind) Same

func (uf *UnionFind) Same(x, y int) bool

func (*UnionFind) Size

func (uf *UnionFind) Size(x int) int

func (*UnionFind) Unite

func (uf *UnionFind) Unite(x, y int) bool

Jump to

Keyboard shortcuts

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