dsgo

package module
v0.0.0-...-8cfa9df Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 0 Imported by: 0

README

dsgo

Data structures for Go, with generics apis.

references

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyHolder = Empty{}

Functions

This section is empty.

Types

type BidMap

type BidMap[K, V comparable] interface {
	Map[K, V]
	GetKey(value V) (key K, found bool)
	RemoveValue(value V)
}

type Cache

type Cache[K comparable, V any] interface {
	Container[V]
	Put(key K, value V)
	Get(key K) (value V, found bool)
	Keys() []K
}

type Comparator

type Comparator[T any] func(a, b T) int

func Reverse

func Reverse[T any](cmp Comparator[T]) Comparator[T]

type Container

type Container[T any] interface {
	Len() int
	Empty() bool
	Values() []T
	Clear()
}

type Empty

type Empty struct{}

type Map

type Map[K comparable, V any] interface {
	Cache[K, V]
	Remove(key K)
}

type Pair

type Pair[K comparable, V any] struct {
	Key   K
	Value V
}

Pair holds a key-value item

type Set

type Set[T comparable] interface {
	Container[T]
	Add(elements ...T)
	Remove(elements ...T)
	Contains(elements ...T) bool
}

type Stack

type Stack[T any] interface {
	Container[T]
	Push(value T)
	Pop() (value T, ok bool)
	Peek() (value T, ok bool)
}

Directories

Path Synopsis
BitSet is a fixed-size sequence of n bits.
BitSet is a fixed-size sequence of n bits.
A hash set can store unique values, without any particular order.
A hash set can store unique values, without any particular order.
Package heapx is an advanced heap, which can remove or update any item in O(nlogn) time.
Package heapx is an advanced heap, which can remove or update any item in O(nlogn) time.
internal
heap
Package heap is a generics version of "container/heap" in the standard library
Package heap is a generics version of "container/heap" in the standard library
Package list implements a doubly linked list.
Package list implements a doubly linked list.
Package listmap is a map that preserves insertion-order.
Package listmap is a map that preserves insertion-order.
A queue gives you a FIFO or first-in firs-out order.
A queue gives you a FIFO or first-in firs-out order.
Package ring implements operations on circular lists.
Package ring implements operations on circular lists.
Package treemap implements a map backed by red-black tree.
Package treemap implements a map backed by red-black tree.
Package treeset implements a tree backed by a red-black tree.
Package treeset implements a tree backed by a red-black tree.

Jump to

Keyboard shortcuts

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