skiplist

package
v0.0.0-...-db1a295 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISkipList

type ISkipList interface {
	// Search 查找是否存在target
	Search(target int) bool
	// Add 添加元素
	Add(num int)
	// Erase 移除元素
	Erase(num int) bool
}

type SkipList

type SkipList struct {
	// contains filtered or unexported fields
}

SkipList 跳表

func Constructor

func Constructor() SkipList

func NewSkipList

func NewSkipList() *SkipList

func (*SkipList) Add

func (s *SkipList) Add(num int)

Add 添加元素

func (*SkipList) Erase

func (s *SkipList) Erase(num int) bool

Erase 移除元素

func (*SkipList) Search

func (s *SkipList) Search(target int) bool

Search 查找是否存在target 由于设置了虚拟节点,那么意味着它存在的话,它必然是某个节点的右节点,就是说它前面一定有一个节点

Jump to

Keyboard shortcuts

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