Documentation ¶
Index ¶
- Constants
- Variables
- type Node
- type Number
- type SkipList
- func (s *SkipList[K, T]) Delete(score K)
- func (s *SkipList[K, T]) Draw() *SkipList[K, T]
- func (s *SkipList[K, T]) Get(score K) (elem T)
- func (s *SkipList[K, T]) GetWithBool(score K) (elem T, ok bool)
- func (s *SkipList[K, T]) GetWithMeta(score K) (elem T, number Number[K], ok bool)
- func (s *SkipList[K, T]) Insert(score K, elem T)
- func (s *SkipList[K, T]) InsertInner(score K, elem T, level int) (prev T, replaced bool)
- func (s *SkipList[K, T]) Len() int
- func (s *SkipList[K, T]) Range(callback func(score K, v T) bool)
- func (s *SkipList[K, T]) RangePrev(callback func(k K, v T) bool) *SkipList[K, T]
- func (s *SkipList[K, T]) Remove(score K) *SkipList[K, T]
- func (s *SkipList[K, T]) Set(score K, elem T)
- func (s *SkipList[K, T]) SetWithPrev(score K, elem T) (prev T, replaced bool)
- func (s *SkipList[K, T]) TopMax(limit int, callback func(k K, v T) bool)
- func (s *SkipList[K, T]) TopMin(limit int, callback func(score K, v T) bool)
Constants ¶
View Source
const (
SKIPLIST_MAXLEVEL = 32
)
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found element")
)
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node[K constraints.Ordered, T any] struct { NodeLevel []struct { // contains filtered or unexported fields } // contains filtered or unexported fields }
type Number ¶
type Number[K constraints.Ordered] struct { Total int Keys []K Level []int MaxLevel []int }
debug 使用
type SkipList ¶
type SkipList[K constraints.Ordered, T any] struct { // contains filtered or unexported fields }
func New ¶
func New[K constraints.Ordered, T any]() *SkipList[K, T]
初始化skiplist func New[T any](compare func(T, T) int) *SkipList[T] {
func (*SkipList[K, T]) GetWithBool ¶ added in v0.0.6
获取
func (*SkipList[K, T]) GetWithMeta ¶
debug使用, 返回查找某个key 比较的次数+经过的节点数
func (*SkipList[K, T]) InsertInner ¶
方便给作者调试用的函数
func (*SkipList[K, T]) SetWithPrev ¶
Click to show internal directories.
Click to hide internal directories.