Documentation ¶
Index ¶
- Constants
- type Element
- type Interface
- type SkipList
- func (sl *SkipList) Back() *Element
- func (sl *SkipList) Delete(v Interface) interface{}
- func (sl *SkipList) Find(v Interface) *Element
- func (sl *SkipList) Front() *Element
- func (sl *SkipList) GetElementByRank(rank int) *Element
- func (sl *SkipList) GetRank(v Interface) int
- func (sl *SkipList) Init() *SkipList
- func (sl *SkipList) Insert(v Interface) *Element
- func (sl *SkipList) Len() int
- func (sl *SkipList) Remove(e *Element) interface{}
Constants ¶
View Source
const SKIPLIST_BRANCH = 4
View Source
const SKIPLIST_MAXLEVEL = 32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct { Value Interface // contains filtered or unexported fields }
type SkipList ¶
type SkipList struct {
// contains filtered or unexported fields
}
func (*SkipList) Delete ¶
Delete deletes an element e that e.Value == v, and returns e.Value or nil.
func (*SkipList) GetElementByRank ¶
GetElementByRank finds an element by ites rank. The rank argument needs bo be 1-based. Note that is the first element e that GetRank(e.Value) == rank, and returns e or nil.
func (*SkipList) GetRank ¶
GetRank finds the rank for an element e that e.Value == v, Returns 0 when the element cannot be found, rank otherwise. Note that the rank is 1-based due to the span of sl.header to the first element.
func (*SkipList) Insert ¶
Insert inserts v, increments sl.length, and returns a new element of wrap v.
Click to show internal directories.
Click to hide internal directories.