skiplist

package module
v0.0.0-...-bf4ac4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2022 License: MulanPSL-2.0 Imports: 3 Imported by: 0

README

impl generic skiplist in go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node[K Ordered, V any] struct {
	Key   K
	Value V
	Next  []*Node[K, V]
	Prev  *Node[K, V]
}

type Ordered

type Ordered interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
		~float32 | ~float64 |
		~string
}

type Skiplist

type Skiplist[K Ordered, V any] struct {
	// contains filtered or unexported fields
}

func NewSkiplist

func NewSkiplist[K Ordered, V any]() *Skiplist[K, V]

func (*Skiplist[K, V]) Delete

func (s *Skiplist[K, V]) Delete(key K) *V

func (*Skiplist[K, V]) Insert

func (s *Skiplist[K, V]) Insert(key K, value V) *Node[K, V]

func (*Skiplist[K, V]) Level

func (s *Skiplist[K, V]) Level() uint32

func (*Skiplist[K, V]) Search

func (s *Skiplist[K, V]) Search(key K) *V

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL