list

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLevel = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type SkipList

type SkipList[T any] struct {
	// contains filtered or unexported fields
}

func NewSkipList

func NewSkipList[T any](cmp jit.Comparator[T]) *SkipList[T]

func SkipListOf

func SkipListOf[T any](cmp jit.Comparator[T], slice []T) *SkipList[T]

func (*SkipList[T]) Delete

func (sl *SkipList[T]) Delete(target T) bool

Delete remove target from the skip list.

func (*SkipList[T]) Exists

func (sl *SkipList[T]) Exists(target T) bool

Exists checks if the target element exists in the skip list and returns true if found, otherwise returns false.

func (*SkipList[T]) GetByIndex

func (sl *SkipList[T]) GetByIndex(index int) (T, bool)

GetByIndex retrieves the value at the specified index in the skip list. The index starts from 0.

func (*SkipList[T]) Insert

func (sl *SkipList[T]) Insert(val T)

Insert inserts a value into the skip list.

func (*SkipList[T]) Len

func (sl *SkipList[T]) Len() int

func (*SkipList[T]) Peek

func (sl *SkipList[T]) Peek() (T, bool)

Peek returns the first element in the skip list without removing it.

func (*SkipList[T]) ToSlice

func (sl *SkipList[T]) ToSlice() []T

Jump to

Keyboard shortcuts

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