binarysearchtree

package
v0.0.0-...-786b671 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node represents a binary search tree node of type T.

func NewNode

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

NewNode creates a new binary search tree node with the given value of type T.

func (*Node[T]) Delete

func (n *Node[T]) Delete(value T) *Node[T]

Delete deletes a value from the binary search tree.

func (*Node[T]) InorderTraversal

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

InorderTraversal traverses the binary search tree in inorder fashion.

func (*Node[T]) Insert

func (n *Node[T]) Insert(value T) *Node[T]

Insert inserts a new node into the binary search tree.

func (*Node[T]) PostorderTraversal

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

PostorderTraversal traverses the binary search tree in postorder fashion.

func (*Node[T]) PreorderTraversal

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

PreorderTraversal traverses the binary search tree in preorder fashion.

func (*Node[T]) Search

func (n *Node[T]) Search(value T) *Node[T]

Search searches a value in the binary search tree.

Jump to

Keyboard shortcuts

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