Documentation ¶
Index ¶
- Constants
- type Comparable
- type Element
- type KV
- type SkipList
- func (sList *SkipList) Delete(key Comparable)
- func (sList *SkipList) Get(k Comparable) (*KV, bool)
- func (sList *SkipList) GetMax() (kv *KV)
- func (sList *SkipList) GetMin() (kv *KV)
- func (sList *SkipList) Len() int
- func (sList *SkipList) PrevNodeCache(k Comparable) []*Element
- func (sList *SkipList) Put(kv *KV)
Constants ¶
View Source
const ( MaxLevel = 18 //最大层数 Probability = 1 / math.E //每一个节点是否可以向上的概率基数 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparable ¶
type Comparable interface {
CompareTo(Comparable) int
}
Comparable 大于返回正数,小于返回负数,等于返回0
type KV ¶
type KV struct { K Comparable V interface{} }
func NewKV ¶
func NewKV(key Comparable, value interface{}) *KV
type SkipList ¶
type SkipList struct {
// contains filtered or unexported fields
}
func NewSkipList ¶
func NewSkipList() *SkipList
func (*SkipList) Get ¶
func (sList *SkipList) Get(k Comparable) (*KV, bool)
Get 获取数据 如果没有相等的数据,返回它的下一个元素(也可能是nil),bool仍是false
func (*SkipList) PrevNodeCache ¶
func (sList *SkipList) PrevNodeCache(k Comparable) []*Element
PrevNodeCache 每一层下来的节点所组成的切片
Click to show internal directories.
Click to hide internal directories.