Documentation
¶
Index ¶
- Constants
- type Node
- type SkipList
- func (sl *SkipList[T]) Clear()
- func (sl *SkipList[T]) Contains(value T) bool
- func (sl *SkipList[T]) Delete(value T) bool
- func (sl *SkipList[T]) GetAll() []T
- func (sl *SkipList[T]) GetMax() T
- func (sl *SkipList[T]) GetMin() T
- func (sl *SkipList[T]) Insert(value T)
- func (sl *SkipList[T]) Len() int
- func (sl *SkipList[T]) RangeQuery(min, max T) []T
- func (sl *SkipList[T]) Search(value T) *Node[T]
Constants ¶
View Source
const ( DefaultMaxLevel = 16 // 最大层数 DefaultProbability = 0.5 // 晋升概率 1/2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SkipList ¶
type SkipList[T any] struct { // contains filtered or unexported fields }
SkipList 泛型跳表
func NewWithConfig ¶
func NewWithConfig[T any](better func(a, b T) bool, maxLevel int, probability float64, withRWLock bool) *SkipList[T]
NewWithConfig 使用自定义配置创建跳表
func (*SkipList[T]) RangeQuery ¶
func (sl *SkipList[T]) RangeQuery(min, max T) []T
RangeQuery 范围查询(并发安全) 返回 [min, max] 范围内的所有元素
Click to show internal directories.
Click to hide internal directories.