Documentation ¶
Index ¶
- func TreeByLevel(root *BNode, fn func(root *BNode))
- type AVLNode
- type BNode
- type Element
- type GEdges
- type GNode
- type Graph
- type LNode
- type Level
- type LinkedQueue
- type LinkedStack
- type Maxheap
- type Minheap
- type NodesMap
- type Person
- type Queue
- type RWMap
- type ScoreBorder
- type Set
- type SliceStack
- type SortedSet
- func (sortedSet *SortedSet) Add(member string, score float64) bool
- func (sortedSet *SortedSet) Count(min *ScoreBorder, max *ScoreBorder) int64
- func (sortedSet *SortedSet) ForEach(start int64, stop int64, desc bool, consumer func(element *Element) bool)
- func (sortedSet *SortedSet) ForEachByScore(min *ScoreBorder, max *ScoreBorder, offset int64, limit int64, desc bool, ...)
- func (sortedSet *SortedSet) Get(member string) (element *Element, ok bool)
- func (sortedSet *SortedSet) GetRank(member string, desc bool) (rank int64)
- func (sortedSet *SortedSet) Len() int64
- func (sortedSet *SortedSet) Range(start int64, stop int64, desc bool) []*Element
- func (sortedSet *SortedSet) RangeByScore(min *ScoreBorder, max *ScoreBorder, offset int64, limit int64, desc bool) []*Element
- func (sortedSet *SortedSet) Remove(member string) bool
- func (sortedSet *SortedSet) RemoveByRank(start int64, stop int64) int64
- func (sortedSet *SortedSet) RemoveByScore(min *ScoreBorder, max *ScoreBorder) int64
- type TrieNode
- type UnionFind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TreeByLevel ¶ added in v0.0.5
TreeByLevel 按层处理二叉树
Types ¶
type LinkedQueue ¶
func NewLinkedQueue ¶
func NewLinkedQueue() *LinkedQueue
func (*LinkedQueue) IsEmpty ¶
func (p *LinkedQueue) IsEmpty() bool
IsEmpty 判断队列是否为空,如果为空返回true,否则返回false
type LinkedStack ¶
LinkedStack 链表所写的stack
func NewLinkedStack ¶
func NewLinkedStack() *LinkedStack
func (*LinkedStack) IsEmpty ¶
func (p *LinkedStack) IsEmpty() bool
func (*LinkedStack) Pop ¶
func (p *LinkedStack) Pop() interface{}
func (*LinkedStack) Push ¶
func (p *LinkedStack) Push(e interface{})
func (*LinkedStack) Size ¶
func (p *LinkedStack) Size() int
func (*LinkedStack) Top ¶
func (p *LinkedStack) Top() interface{}
type Maxheap ¶ added in v0.0.4
func NewMaxheap ¶ added in v0.0.4
func NewMaxheap() *Maxheap
func (*Maxheap) HeapInsert ¶ added in v0.0.4
HeapInsert 大跟堆生成
type Minheap ¶ added in v0.0.4
func NewMinheap ¶ added in v0.0.4
func NewMinheap() *Minheap
type Queue ¶
func NewSliceQueue ¶
func NewSliceQueue() *Queue
type RWMap ¶ added in v0.0.6
读写锁 map
func (*RWMap) JsonMarshal ¶ added in v0.0.6
JsonMarshal json序列化
type ScoreBorder ¶
ScoreBorder represents range of a float value, including: <, <=, >, >=, +inf, -inf
func ParseScoreBorder ¶
func ParseScoreBorder(s string) (*ScoreBorder, error)
ParseScoreBorder creates ScoreBorder from redis arguments
type SliceStack ¶
SliceStack slice所写的stack
func NewSliceStack ¶
func NewSliceStack() *SliceStack
func (*SliceStack) List ¶
func (p *SliceStack) List() []interface{}
type SortedSet ¶
type SortedSet struct {
// contains filtered or unexported fields
}
SortedSet is a set which keys sorted by bound score
func (*SortedSet) Count ¶
func (sortedSet *SortedSet) Count(min *ScoreBorder, max *ScoreBorder) int64
Count returns the number of members which score within the given border
func (*SortedSet) ForEach ¶
func (sortedSet *SortedSet) ForEach(start int64, stop int64, desc bool, consumer func(element *Element) bool)
ForEach visits each member which rank within [start, stop), sort by ascending order, rank starts from 0
func (*SortedSet) ForEachByScore ¶
func (sortedSet *SortedSet) ForEachByScore(min *ScoreBorder, max *ScoreBorder, offset int64, limit int64, desc bool, consumer func(element *Element) bool)
ForEachByScore visits members which score within the given border
func (*SortedSet) GetRank ¶
GetRank returns the rank of the given member, sort by ascending order, rank starts from 0
func (*SortedSet) Range ¶
Range returns members which rank within [start, stop), sort by ascending order, rank starts from 0
func (*SortedSet) RangeByScore ¶
func (sortedSet *SortedSet) RangeByScore(min *ScoreBorder, max *ScoreBorder, offset int64, limit int64, desc bool) []*Element
RangeByScore returns members which score within the given border param limit: <0 means no limit
func (*SortedSet) RemoveByRank ¶
RemoveByRank removes member ranking within [start, stop) sort by ascending order and rank starts from 0
func (*SortedSet) RemoveByScore ¶
func (sortedSet *SortedSet) RemoveByScore(min *ScoreBorder, max *ScoreBorder) int64
RemoveByScore removes members which score within the given border
type TrieNode ¶
type TrieNode struct { IsLeaf bool Url string Child []*TrieNode // contains filtered or unexported fields }
TrieNode 前缀树
func NewTrieNode ¶
type UnionFind ¶ added in v0.0.6
type UnionFind struct {
// contains filtered or unexported fields
}
func NewUnionFind ¶ added in v0.0.6
New returns an initialized list of size
func (*UnionFind) IsConnected ¶ added in v0.0.6
IsConnected Check if items p,q are connected