Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyForDeletion = errors.New("Node child poistions is already empty")
View Source
var ErrNotEmptyForInsertion = errors.New("Node child poistions not empty for insertion")
Functions ¶
This section is empty.
Types ¶
type BinaryTree ¶
type BinaryTree struct {
Root *Node
}
func Init ¶
func Init(payload interface{}) *BinaryTree
Init : Initializes a new binary tree with the given payload
func (*BinaryTree) ToSliceInOrder ¶
func (bt *BinaryTree) ToSliceInOrder() *[]Payload
ToSliceInOrder : Returns a slice of the tree in in-order traversal
func (*BinaryTree) ToSlicePostOrder ¶
func (bt *BinaryTree) ToSlicePostOrder() *[]Payload
ToSlicePostOrder : Returns a slice of the tree in post order
func (*BinaryTree) ToSlicePreOrder ¶
func (bt *BinaryTree) ToSlicePreOrder() *[]Payload
ToSlicePreOrder : Returns a slice of the tree in pre-order
type Node ¶
type Node struct {
Payload Payload
// contains filtered or unexported fields
}
func (*Node) DeleteLeft ¶
DeleteLeft : Deletes the left child of the node
func (*Node) DeleteRight ¶
DeleteRight : Deletes the right child of the node
func (*Node) InsertLeft ¶
InsertLeft : Inserts a node to the left of the current node
Click to show internal directories.
Click to hide internal directories.