Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Skip list implemented in Go.
Go Shell
Latest commit 7ab5ac9 @huandu Merge pull request #2 from cburkert/patch-1
Fixed copy paste error in URL travis-ci status

Skip List in Golang

Build Status GoDoc

Skip list is a kind of ordered map and can store any value inside. See skip list wikipedia page to learn more about this data structure.

Highlights in this implementation:

  • Support custom compare function so that any type can be used as key.
  • Key sort order can be changed quite easily.
  • Rand source and max level can be changed per list. It can be useful in performance critical scenarios.

How To Use

Install this package through go get.

go get

Use it as following.

package main

import (

func main() {
    // Create a skip list with int key.
    list := skiplist.New(skiplist.Int)

    // Add some values. Value can be anything.
    list.Set(12, "hello world")
    list.Set(34, 56)

    // Get element by index.
    elem := list.Get(34) // Value is stored in elem.Value.
    next := elem.Next()  // Get next element.

    // Or get value directly just like a map
    val, ok := list.GetValue(34)
    fmt.Println(val, ok)

    // Remove an element by index.


This library is licensed under MIT license. See LICENSE for details.

Something went wrong with that request. Please try again.