Documentation ¶
Index ¶
- type SkipList
- func (s *SkipList[K, V]) Del(k K) (v V, ok bool)
- func (s *SkipList[K, V]) Get(k interface{}) (v interface{}, ok bool)
- func (s *SkipList[K, V]) Len() int
- func (s *SkipList[K, V]) Range(from, to interface{}, op func(v interface{}))
- func (s *SkipList[K, V]) Search(k interface{}) (ok bool)
- func (s *SkipList[K, V]) Set(k interface{}, v interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SkipList ¶
type SkipList[K constraints.Ordered, V any] struct { MaxLevel int // contains filtered or unexported fields }
A SkipList maintains an ordered collection of key:valkue pairs. It support insertion, lookup, and deletion operations with O(log n) time complexity Paper: Pugh, William (June 1990). "Skip lists: a probabilistic alternative to balanced trees". Communications of the ACM 33 (6): 668–676
func (*SkipList[K, V]) Range ¶
func (s *SkipList[K, V]) Range(from, to interface{}, op func(v interface{}))
Range interates `from` to `to` with `op`.
Click to show internal directories.
Click to hide internal directories.