binarytree

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 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 struct {
	Value int
	Left  *Node
	Right *Node
}

Node is the atomic struct of the Tree

func (*Node) Print

func (n *Node) Print() string

Print is delegated to print the current node

type Tree

type Tree struct {
	Root *Node
}

Tree wrap the node structure

func (*Tree) Height

func (t *Tree) Height() int

Height is delegated to compute the lenght of the tree

func (*Tree) InitTree

func (t *Tree) InitTree(val int)

InitTree is delegated to initialize a new Tree

func (*Tree) Insert

func (t *Tree) Insert(val int)

Insert is delegated to insert a new node into the Tree

func (*Tree) Print

func (t *Tree) Print() string

func (*Tree) Remove

func (t *Tree) Remove(val int)

Remove is delegated to remove a node with the given value from the Tree

func (*Tree) VisitInOrder

func (t *Tree) VisitInOrder() []int

VisitPreOrder is delegated to traverse the Tree in pre order

func (*Tree) VisitPostOrder

func (t *Tree) VisitPostOrder() []int

VisitPostOrder is delegated to traverse the Tree in post order

func (*Tree) VisitPreOrder

func (t *Tree) VisitPreOrder() []int

VisitPreOrder is delegated to traverse the Tree in pre order

Jump to

Keyboard shortcuts

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