Documentation ¶
Overview ¶
Package tree implements a very simple binary tree without any balancing. This is mainly intended as a proof of concept for a strongly typed tree in Go without using reflection or casts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Compare ¶
Comparer is a comparison function that should return -1 if data[i] < data[i], 0 if equal, and 1 if greater than
type Tree ¶
type Tree struct {
Head *Node
}
Tree holds a binary tree data organization.
Note that Tree is not intended to hold data itself, it just maintains a structure, and data is retrieved using a node's Val as the index into another data structure that holds the actual values
func (*Tree) Delete ¶
Delete removes the node of the tree with the value at index i
Delete returns the index of rhte item if the value was found, otherwise will return an error