dstructs

package
v0.0.0-...-9c779f9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashList

type HashList[V comparable, K Node[K]] struct {
	Description string
	// contains filtered or unexported fields
}

func NewHashList

func NewHashList[V comparable, K Node[K]](description string, hf func(*K) V, of func(*K, *K) int) *HashList[V, K]

func (*HashList[V, K]) Add

func (hl *HashList[V, K]) Add(n *K) error

func (*HashList[V, K]) Count

func (hl *HashList[V, K]) Count() int

func (*HashList[V, K]) GetNodes

func (hl *HashList[V, K]) GetNodes() []*K

func (*HashList[V, K]) GoString

func (hl *HashList[V, K]) GoString() string

func (*HashList[V, K]) String

func (hl *HashList[V, K]) String() string

type List

type List[T Node[T]] struct {
	Head linkNode[T]
	Tail linkNode[T]

	Description string

	OrderFunc func(*T, *T) int
}

func NewList

func NewList[T Node[T]](description string, fn func(*T, *T) int) *List[T]

func (*List[T]) Filter

func (l *List[T]) Filter(fn func(*T) int) []*T

func (*List[T]) Get

func (l *List[T]) Get(n *T) *T

func (*List[T]) GetNodes

func (l *List[T]) GetNodes() []*T

func (*List[T]) GoString

func (l *List[T]) GoString() string

func (*List[T]) InsertHead

func (l *List[T]) InsertHead(data *T) error

func (*List[T]) InsertOrdered

func (l *List[T]) InsertOrdered(data *T) error

func (*List[T]) InsertTail

func (l *List[T]) InsertTail(data *T)

func (*List[T]) Len

func (l *List[T]) Len() int

func (*List[T]) String

func (l *List[T]) String() string

type Node

type Node[T any] interface {
	Compare(*T) int
}

Jump to

Keyboard shortcuts

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