Documentation ¶
Index ¶
- type Node
- func (n *Node) Depth(root trees.Node) int
- func (n *Node) Height() int
- func (n *Node) IsLeaf() bool
- func (n *Node) IsNil() bool
- func (n *Node) Value() interface{}
- func (n *Node) VisitInOrder(consumer func(interface{}))
- func (n *Node) VisitPostOrder(consumer func(interface{}))
- func (n *Node) VisitPreOrder(consumer func(interface{}))
- type Tree
- func (t *Tree) Cap() int
- func (t *Tree) Delete(x interface{}) trees.Node
- func (t *Tree) Find(x interface{}) trees.Node
- func (t *Tree) Glb(x interface{}) trees.Node
- func (t *Tree) GlbEq(x interface{}) trees.Node
- func (t *Tree) Insert(x interface{}) trees.Node
- func (t *Tree) IsEmpty() bool
- func (t *Tree) IsFull() bool
- func (t *Tree) Len() int
- func (t *Tree) Lub(x interface{}) trees.Node
- func (t *Tree) LubEq(x interface{}) trees.Node
- func (t *Tree) Max() interface{}
- func (t *Tree) Min() interface{}
- func (t *Tree) VisitInOrder(consumer func(interface{}))
- func (t *Tree) VisitPostOrder(consumer func(interface{}))
- func (t *Tree) VisitPreOrder(consumer func(interface{}))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a node in Tree.
func (*Node) VisitInOrder ¶
func (n *Node) VisitInOrder(consumer func(interface{}))
VisitInOrder traverses the subtree rooted at n in in-order (LNR).
func (*Node) VisitPostOrder ¶
func (n *Node) VisitPostOrder(consumer func(interface{}))
VisitPostOrder traverses the subtree rooted at n in post-order (LRN).
func (*Node) VisitPreOrder ¶
func (n *Node) VisitPreOrder(consumer func(interface{}))
VisitPreOrder traverses the subtree rooted at n in pre-order (NLR).
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree implements an unbalanced binary search tree.
func (*Tree) VisitInOrder ¶
func (t *Tree) VisitInOrder(consumer func(interface{}))
func (*Tree) VisitPostOrder ¶
func (t *Tree) VisitPostOrder(consumer func(interface{}))
func (*Tree) VisitPreOrder ¶
func (t *Tree) VisitPreOrder(consumer func(interface{}))
Click to show internal directories.
Click to hide internal directories.