Documentation ¶
Index ¶
- type BinarySearchTree
- func (bst *BinarySearchTree) Get(key string) Item
- func (bst *BinarySearchTree) InOrderTraverse(f func(Item))
- func (bst *BinarySearchTree) Insert(key string, value Item)
- func (bst *BinarySearchTree) Max() *Item
- func (bst *BinarySearchTree) Min() *Item
- func (bst *BinarySearchTree) PostOrderTraverse(f func(Item))
- func (bst *BinarySearchTree) PreOrderTraverse(f func(Item))
- func (bst *BinarySearchTree) Remove(key string)
- func (bst *BinarySearchTree) Search(key string) bool
- func (bst *BinarySearchTree) String() string
- type Item
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinarySearchTree ¶
type BinarySearchTree struct { Root *Node // contains filtered or unexported fields }
func (*BinarySearchTree) Get ¶
func (bst *BinarySearchTree) Get(key string) Item
Search returns the item if it exists, else returns an empty string
func (*BinarySearchTree) InOrderTraverse ¶
func (bst *BinarySearchTree) InOrderTraverse(f func(Item))
func (*BinarySearchTree) Insert ¶
func (bst *BinarySearchTree) Insert(key string, value Item)
func (*BinarySearchTree) Max ¶
func (bst *BinarySearchTree) Max() *Item
Max returns the Item with max Value stored in the tree
func (*BinarySearchTree) Min ¶
func (bst *BinarySearchTree) Min() *Item
Min returns the Item with min Value stored in the tree
func (*BinarySearchTree) PostOrderTraverse ¶
func (bst *BinarySearchTree) PostOrderTraverse(f func(Item))
PostOrderTraverse visits all nodes with post-order traversing
func (*BinarySearchTree) PreOrderTraverse ¶
func (bst *BinarySearchTree) PreOrderTraverse(f func(Item))
PreOrderTraverse visits all nodes with pre-order traversing
func (*BinarySearchTree) Remove ¶
func (bst *BinarySearchTree) Remove(key string)
Remove removes the Item with key `key` from the tree
func (*BinarySearchTree) Search ¶
func (bst *BinarySearchTree) Search(key string) bool
Search returns true if the Item t exists in the tree
func (*BinarySearchTree) String ¶
func (bst *BinarySearchTree) String() string
Click to show internal directories.
Click to hide internal directories.