tree

package
v0.0.0-...-544ef16 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTree

func PrintTree(node *Node, h int)

PrintTree prints the tree.

Types

type Node

type Node struct {
	Value       int
	Left, Right *Node
	Parent      *Node
}

Node is a node in the tree, having a parent pointer.

func CreateBinarySearchTree

func CreateBinarySearchTree(sortedValues []int, parent *Node) *Node

CreateBinarySearchTree creates a balanced binary search tree, given the sorted values. Returns the root node.

func CreateRandomTree

func CreateRandomTree(min, max, maxDepth int, parent *Node) *Node

CreateRandomTree creates a random tree with a maximum Depth.

Jump to

Keyboard shortcuts

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