Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node[K, V any] struct { // contains filtered or unexported fields }
Node is a list node
type Option ¶
type Option func(option *Options)
Option is a function used to set Options
func WithGoroutineSafe ¶
func WithGoroutineSafe() Option
WithGoroutineSafe sets Skiplist goroutine-safety,
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds Skiplist's options
type Skiplist ¶
type Skiplist[K, V any] struct { // contains filtered or unexported fields }
Skiplist is a kind of data structure which can search quickly by exchanging space for time
func New ¶
func New[K, V any](cmp comparator.Comparator[K], opts ...Option) *Skiplist[K, V]
New news a Skiplist
func (*Skiplist[K, V]) Get ¶
Get returns the value associated with the passed key if the key is in the skiplist, otherwise returns error
func (*Skiplist[K, V]) Insert ¶
func (sl *Skiplist[K, V]) Insert(key K, value V)
Insert inserts a key-value pair into the skiplist
func (*Skiplist[K, V]) Keys ¶
func (sl *Skiplist[K, V]) Keys() []K
Keys returns all keys in the skiplist
Click to show internal directories.
Click to hide internal directories.