skiplist

package
v0.0.0-...-1ed9750 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SkipList

type SkipList struct {
	MaxLevel   int
	P          float64
	Level      int
	Header     *node
	Randomizer *rand.Rand
}

SkipList : Structure to hold the skiplist datastructure

func NewSkipList

func NewSkipList(maxLevel int, p float64) *SkipList

NewSkipList : Constructor for the `SkipList` datastructure

func (*SkipList) Delete

func (sl *SkipList) Delete(key int) bool

Delete : delete the `key` from the `SkipList` if present. Return a boolean indicating the actual removal.

func (*SkipList) Display

func (sl *SkipList) Display() string

Display : Return a string representation of the `SkipList`

func (*SkipList) Insert

func (sl *SkipList) Insert(key int) bool

Insert : insert `key` in the `SkipList`, return a boolean indicating if a new entry was added in the `SkipList`

func (*SkipList) Search

func (sl *SkipList) Search(key int) bool

Search : search `key` in the `SkipList`, return a boolean to indicate whether the `key` was found in the `SkipList`

Jump to

Keyboard shortcuts

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