binarytree

package
v0.0.0-...-6223807 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryTree

type BinaryTree[Ord constraints.Ordered, T any] struct {
	// contains filtered or unexported fields
}

BinaryTree is a simple binary search tree that does not guarantee balance

func New

func New[Ord constraints.Ordered, T any]() *BinaryTree[Ord, T]

func (*BinaryTree[Ord, T]) Del

func (st *BinaryTree[Ord, T]) Del(key Ord)

func (*BinaryTree[Ord, T]) Get

func (st *BinaryTree[Ord, T]) Get(key Ord) (T, bool)

func (*BinaryTree[Ord, T]) GetMax

func (st *BinaryTree[Ord, T]) GetMax() T

func (*BinaryTree[Ord, T]) GetMin

func (st *BinaryTree[Ord, T]) GetMin() T

func (*BinaryTree[Ord, T]) InOrder

func (st *BinaryTree[Ord, T]) InOrder(fn func(*Node[Ord, T]) bool)

func (*BinaryTree[Ord, T]) LevelOrder

func (st *BinaryTree[Ord, T]) LevelOrder(fn func(*Node[Ord, T]) bool)

func (*BinaryTree[Ord, T]) PreOrder

func (st *BinaryTree[Ord, T]) PreOrder(fn func(*Node[Ord, T]) bool)

func (*BinaryTree[Ord, T]) Put

func (st *BinaryTree[Ord, T]) Put(key Ord, val T)

func (*BinaryTree[Ord, T]) ReverseOrder

func (st *BinaryTree[Ord, T]) ReverseOrder(fn func(*Node[Ord, T]) bool)

func (*BinaryTree[Ord, T]) Size

func (st *BinaryTree[Ord, T]) Size() uint

func (*BinaryTree[Ord, T]) SufOrder

func (st *BinaryTree[Ord, T]) SufOrder(fn func(*Node[Ord, T]) bool)

type Node

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

func (*Node[Ord, T]) IsNil

func (n *Node[Ord, T]) IsNil() bool

func (*Node[Ord, T]) Key

func (n *Node[Ord, T]) Key() Ord

func (*Node[Ord, T]) Left

func (n *Node[Ord, T]) Left() search.ITraversal

func (*Node[Ord, T]) Right

func (n *Node[Ord, T]) Right() search.ITraversal

func (*Node[Ord, T]) String

func (n *Node[Ord, T]) String() string

Jump to

Keyboard shortcuts

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