Documentation ¶
Index ¶
- Constants
- func BSTreeToString(n *BSTreeNode, depth int, buffer *bytes.Buffer)
- func NewAVLTreeNode(k interface{}, v interface{}) *avlTreeNode
- func NewRBTreeNode(key interface{}, value interface{}) *rbTreeNode
- type AVLTree
- func (at *AVLTree) Add(key interface{}, val interface{})
- func (at *AVLTree) Contains(key interface{}) bool
- func (at *AVLTree) Get(key interface{}) interface{}
- func (at *AVLTree) IsBST() bool
- func (at *AVLTree) IsBalanced() bool
- func (at *AVLTree) IsEmpty() bool
- func (at *AVLTree) Remove(key interface{}) interface{}
- func (at *AVLTree) Set(key interface{}, val interface{})
- func (at *AVLTree) Size() int
- func (at *AVLTree) String() string
- type BSTree
- func (tree *BSTree) Add(e interface{})
- func (tree *BSTree) Contains(e interface{}) bool
- func (tree *BSTree) InOrder()
- func (tree *BSTree) IsEmpty() bool
- func (tree *BSTree) LevelOrder()
- func (tree *BSTree) Maximum() interface{}
- func (tree *BSTree) Minimum() interface{}
- func (tree *BSTree) PostOrder()
- func (tree *BSTree) PreOrder()
- func (tree *BSTree) PreOrderNR()
- func (tree *BSTree) Remove(e interface{})
- func (tree *BSTree) RemoveMax() interface{}
- func (tree *BSTree) RemoveMin() interface{}
- func (tree *BSTree) Size() int
- func (tree *BSTree) String() string
- type BSTreeNode
- type ITree
- type Merger
- type RBTree
- func (rt *RBTree) Add(key interface{}, val interface{})
- func (rt *RBTree) Contains(key interface{}) bool
- func (rt *RBTree) Get(key interface{}) interface{}
- func (rt *RBTree) IsEmpty() bool
- func (rt *RBTree) KeySet() []interface{}
- func (rt *RBTree) Remove(key interface{}) interface{}
- func (rt *RBTree) Set(key interface{}, val interface{})
- func (rt *RBTree) Size() int
- func (rt *RBTree) String() string
- type SegmentTree
- type Trie
- type TrieNode
Constants ¶
View Source
const BLACK = false
View Source
const RED = true
Variables ¶
This section is empty.
Functions ¶
func BSTreeToString ¶
func BSTreeToString(n *BSTreeNode, depth int, buffer *bytes.Buffer)
生成以 BSTreeNode 为根节点,深度为 depth 的描述二叉树的字符串
func NewAVLTreeNode ¶
func NewAVLTreeNode(k interface{}, v interface{}) *avlTreeNode
生成 avlTreeNode 节点
func NewRBTreeNode ¶
func NewRBTreeNode(key interface{}, value interface{}) *rbTreeNode
生成node节点,默认为红色
Types ¶
type AVLTree ¶
type AVLTree struct {
// contains filtered or unexported fields
}
AVLTree 平衡二叉树
func NewAVLTree ¶
func NewAVLTree() *AVLTree
type BSTreeNode ¶
type BSTreeNode struct {
// contains filtered or unexported fields
}
二分查找树
func NewBSTreeNode ¶
func NewBSTreeNode(e interface{}) *BSTreeNode
type RBTree ¶
type RBTree struct {
// contains filtered or unexported fields
}
RBTree 红黑树
type SegmentTree ¶
type SegmentTree struct {
// contains filtered or unexported fields
}
func NewSegmentTree ¶
func NewSegmentTree(arr []interface{}, merger Merger) *SegmentTree
func (*SegmentTree) Get ¶
func (st *SegmentTree) Get(index int) interface{}
func (*SegmentTree) Query ¶
func (st *SegmentTree) Query(queryL int, queryR int) interface{}
返回区间[queryL, queryR]的值
func (*SegmentTree) Set ¶
func (st *SegmentTree) Set(index int, e interface{})
func (*SegmentTree) Size ¶
func (st *SegmentTree) Size() int
func (*SegmentTree) String ¶
func (st *SegmentTree) String() string
Click to show internal directories.
Click to hide internal directories.