bst

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 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 BST

type BST[T ordered, M any] struct {
	Root Node[T, M]
}

func NewBST

func NewBST[T ordered, M any](value T, meta M) BST[T, M]

func (*BST[T, M]) Add

func (this *BST[T, M]) Add(value T, meta M)

func (*BST[T, M]) InOrderSeq

func (this *BST[T, M]) InOrderSeq() iter.Seq[*Node[T, M]]

func (*BST[T, M]) Max

func (this *BST[T, M]) Max() *Node[T, M]

func (*BST[T, M]) Min

func (this *BST[T, M]) Min() *Node[T, M]

func (BST[T, M]) NewBalanced

func (this BST[T, M]) NewBalanced() BST[T, M]

func (*BST[T, M]) PostOrderSeq

func (this *BST[T, M]) PostOrderSeq() iter.Seq[*Node[T, M]]

func (*BST[T, M]) PreOrderSeq

func (this *BST[T, M]) PreOrderSeq() iter.Seq[*Node[T, M]]

func (*BST[T, M]) Remove

func (this *BST[T, M]) Remove(value T) (Node[T, M], bool)

func (*BST[T, M]) Search

func (this *BST[T, M]) Search(value T) (*Node[T, M], bool)

type Node

type Node[T ordered, M any] struct {
	Value T
	Meta  M
	Left  *Node[T, M]
	Right *Node[T, M]
}

func FromSortedList

func FromSortedList[T ordered, M any](values []NodeValue[T, M]) Node[T, M]

func NewNode

func NewNode[T ordered, M any](value T, meta M) Node[T, M]

func (*Node[T, M]) Add

func (this *Node[T, M]) Add(value T, meta M)

func (*Node[T, M]) InOrderSeq

func (this *Node[T, M]) InOrderSeq() iter.Seq[*Node[T, M]]

func (*Node[T, M]) Max

func (this *Node[T, M]) Max() *Node[T, M]

func (*Node[T, M]) Min

func (this *Node[T, M]) Min() *Node[T, M]

func (*Node[T, M]) PostOrderSeq

func (this *Node[T, M]) PostOrderSeq() iter.Seq[*Node[T, M]]

func (*Node[T, M]) PreOrderSeq

func (this *Node[T, M]) PreOrderSeq() iter.Seq[*Node[T, M]]

func (*Node[T, M]) Search

func (this *Node[T, M]) Search(value T) (*Node[T, M], bool)

type NodeValue

type NodeValue[T ordered, M any] struct {
	Value T
	Meta  M
}

Jump to

Keyboard shortcuts

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