trees

package
v0.0.0-...-6a62fe9 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnimplemented = errors.New("unimplemented")

Functions

This section is empty.

Types

type AVLTree

type AVLTree[T constraints.Ordered] struct {
	*BaseTree[T]
}

func NewAVLTree

func NewAVLTree[T constraints.Ordered]() *AVLTree[T]

func (*AVLTree[T]) Delete

func (t *AVLTree[T]) Delete(z *Node[T])

func (*AVLTree[T]) Insert

func (t *AVLTree[T]) Insert(z *Node[T])

type BaseTree

type BaseTree[T constraints.Ordered] struct {
	// contains filtered or unexported fields
}

func NewBaseTree

func NewBaseTree[T constraints.Ordered]() *BaseTree[T]

func (*BaseTree[T]) Begin

func (t *BaseTree[T]) Begin() *Node[T]

func (*BaseTree[T]) Clear

func (t *BaseTree[T]) Clear()

func (*BaseTree[T]) Delete

func (t *BaseTree[T]) Delete(*Node[T])

func (*BaseTree[T]) Empty

func (t *BaseTree[T]) Empty() bool

func (*BaseTree[T]) End

func (t *BaseTree[T]) End() *Node[T]

func (*BaseTree[T]) Find

func (t *BaseTree[T]) Find(data T) *Node[T]

func (*BaseTree[T]) Insert

func (t *BaseTree[T]) Insert(*Node[T])

func (*BaseTree[T]) Size

func (t *BaseTree[T]) Size() int

type Node

type Node[T constraints.Ordered] struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode[T constraints.Ordered](data T) *Node[T]

func (*Node[T]) Data

func (n *Node[T]) Data() T

type RBTree

type RBTree[T constraints.Ordered] struct {
	*BaseTree[T]
}

func NewRBTree

func NewRBTree[T constraints.Ordered]() *RBTree[T]

func (*RBTree[T]) Delete

func (t *RBTree[T]) Delete(z *Node[T])

func (*RBTree[T]) Insert

func (t *RBTree[T]) Insert(z *Node[T])

type Tree

type Tree[T constraints.Ordered] interface {
	Size() int
	Empty() bool
	Begin() *Node[T]
	End() *Node[T]
	Clear()
	Find(data T) *Node[T]
	Insert(*Node[T])
	Delete(*Node[T])
}

Jump to

Keyboard shortcuts

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