skiplist

package
v0.0.0-...-0e61b49 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MinProb = 0.01

MinProb Minimum probability of bernoulli trial success for random function

View Source
const SkiplistMaxLevel = 30

SkiplistMaxLevel maximum levels allocated for each Skiplist next pointer arrays are of constant size

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node[A any] struct {
	// contains filtered or unexported fields
}

type Skiplist

type Skiplist[A any] struct {
	// contains filtered or unexported fields
}

* Skiplist : The Skiplist structure, must be initialised before use.

func New

func New[A any](prob float64, maxLevels int, fastRandom bool) *Skiplist[A]

func (*Skiplist[A]) Contains

func (list *Skiplist[A]) Contains(val A) bool

func (*Skiplist[A]) Find

func (list *Skiplist[A]) Find(val A, prev, next []*Node[A]) (foundLevel int)

func (*Skiplist[A]) Get

func (list *Skiplist[A]) Get(val A) maybe.Maybe[A]

func (*Skiplist[A]) Height

func (list *Skiplist[A]) Height() int

func (*Skiplist[A]) Insert

func (list *Skiplist[A]) Insert(v A) bool

func (*Skiplist[A]) Len

func (list *Skiplist[A]) Len() int

func (*Skiplist[A]) Remove

func (list *Skiplist[A]) Remove(val A) bool

func (*Skiplist[A]) ToSortedArray

func (list *Skiplist[A]) ToSortedArray() []A

Jump to

Keyboard shortcuts

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