adt

package
v0.0.0-...-a1c1f5a Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Capacity = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type BitVector

type BitVector[T constraints.Unsigned] struct {
	// contains filtered or unexported fields
}

BitVector -----------------------------------------------

func NewBitVectorSet

func NewBitVectorSet[T constraints.Unsigned](init T) *BitVector[T]

func (*BitVector[T]) Add

func (b *BitVector[T]) Add(t ...T)

func (*BitVector[T]) Clone

func (b *BitVector[T]) Clone() Set[T]

func (*BitVector[T]) Contains

func (b *BitVector[T]) Contains(t T) bool

func (*BitVector[T]) Diff

func (b *BitVector[T]) Diff(s Set[T]) Set[T]

func (*BitVector[T]) Elems

func (b *BitVector[T]) Elems() (elems []T)

func (*BitVector[T]) Empty

func (b *BitVector[T]) Empty() bool

func (*BitVector[T]) Equal

func (b *BitVector[T]) Equal(s Set[T]) bool

func (*BitVector[T]) Intersect

func (b *BitVector[T]) Intersect(s Set[T]) Set[T]

func (*BitVector[T]) Pop

func (b *BitVector[T]) Pop() T

func (*BitVector[T]) Remove

func (b *BitVector[T]) Remove(t ...T) Set[T]

func (*BitVector[T]) Size

func (b *BitVector[T]) Size() int

func (*BitVector[T]) Union

func (b *BitVector[T]) Union(s Set[T]) Set[T]

type HashSet

type HashSet[T comparable] struct {
	// contains filtered or unexported fields
}

HashSet -------------------------------------------------------------

func NewHashSet

func NewHashSet[T comparable]() *HashSet[T]

func (*HashSet[T]) Add

func (h *HashSet[T]) Add(s ...T)

func (*HashSet[T]) Clone

func (h *HashSet[T]) Clone() Set[T]

func (*HashSet[T]) Contains

func (h *HashSet[T]) Contains(t T) bool

func (*HashSet[T]) Diff

func (h *HashSet[T]) Diff(other Set[T]) Set[T]

func (*HashSet[T]) Elems

func (h *HashSet[T]) Elems() []T

func (*HashSet[T]) Empty

func (h *HashSet[T]) Empty() bool

func (*HashSet[T]) Equal

func (h *HashSet[T]) Equal(other Set[T]) bool

func (*HashSet[T]) Intersect

func (h *HashSet[T]) Intersect(s Set[T]) Set[T]

func (*HashSet[T]) Pop

func (h *HashSet[T]) Pop() T

func (*HashSet[T]) Remove

func (h *HashSet[T]) Remove(s ...T) Set[T]

func (*HashSet[T]) Size

func (h *HashSet[T]) Size() int

func (*HashSet[T]) Union

func (h *HashSet[T]) Union(other Set[T]) Set[T]

type Queue

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

func NewQueue

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

func NewQueueFrom

func NewQueueFrom[T any](data []T) *Queue[T]

func (*Queue[T]) Dequeue

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

func (*Queue[T]) Empty

func (q *Queue[T]) Empty() bool

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(elem T)

func (*Queue[T]) First

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

func (*Queue[T]) Size

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

type Set

type Set[T comparable] interface {
	Union(Set[T]) Set[T]
	Intersect(Set[T]) Set[T]
	Diff(Set[T]) Set[T]
	Size() int
	Add(...T)
	Remove(...T) Set[T]
	Contains(T) bool
	Clone() Set[T]
	Empty() bool
	Elems() []T
	Pop() T
	Equal(Set[T]) bool
}

type Stack

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

func NewStack

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

func (*Stack[T]) Empty

func (s *Stack[T]) Empty() bool

func (*Stack[T]) Pop

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

func (*Stack[T]) Push

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

func (*Stack[T]) Size

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

func (*Stack[T]) Top

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

Jump to

Keyboard shortcuts

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