{"id":13499783,"url":"https://github.com/ryszard/goskiplist","last_synced_at":"2025-05-16T14:07:06.242Z","repository":{"id":3232690,"uuid":"4268733","full_name":"ryszard/goskiplist","owner":"ryszard","description":"A skip list implementation in Go","archived":false,"fork":false,"pushed_at":"2019-10-29T10:07:30.000Z","size":199,"stargazers_count":238,"open_issues_count":6,"forks_count":60,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-19T16:30:25.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryszard.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-09T05:44:59.000Z","updated_at":"2025-03-05T18:49:18.000Z","dependencies_parsed_at":"2022-07-08T01:45:06.262Z","dependency_job_id":null,"html_url":"https://github.com/ryszard/goskiplist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryszard%2Fgoskiplist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryszard%2Fgoskiplist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryszard%2Fgoskiplist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryszard%2Fgoskiplist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryszard","download_url":"https://codeload.github.com/ryszard/goskiplist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:00:42.019Z","updated_at":"2025-05-16T14:07:06.221Z","avatar_url":"https://github.com/ryszard.png","language":"Go","funding_links":[],"categories":["Data Structures","数据结构","Uncategorized","\u003cspan id=\"数据结构-data-structures\"\u003e数据结构 Data Structures\u003c/span\u003e","数据结构`go语言实现的数据结构与算法`"],"sub_categories":["Advanced Console UIs","Standard CLI","标准 CLI","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"About\n=====\n\nThis is a library implementing skip lists for the Go programming\nlanguage (http://golang.org/).\n\nSkip lists are a data structure that can be used in place of\nbalanced trees. Skip lists use probabilistic balancing rather than\nstrictly enforced balancing and as a result the algorithms for\ninsertion and deletion in skip lists are much simpler and\nsignificantly faster than equivalent algorithms for balanced trees.\n\nSkip lists were first described in\n[Pugh, William (June 1990)](ftp://ftp.cs.umd.edu/pub/skipLists/skiplists.pdf). \"Skip\nlists: a probabilistic alternative to balanced trees\". Communications\nof the ACM 33 (6): 668–676\n\n[![Build Status](https://travis-ci.org/ryszard/goskiplist.png?branch=master)](https://travis-ci.org/ryszard/goskiplist)\n\nInstalling\n==========\n\n    $ go get github.com/ryszard/goskiplist/skiplist\n\nExample\n=======\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/ryszard/goskiplist/skiplist\"\n)\n\nfunc main() {\n\ts := skiplist.NewIntMap()\n\ts.Set(7, \"seven\")\n\ts.Set(1, \"one\")\n\ts.Set(0, \"zero\")\n\ts.Set(5, \"five\")\n\ts.Set(9, \"nine\")\n\ts.Set(10, \"ten\")\n\ts.Set(3, \"three\")\n\n\tfirstValue, ok := s.Get(0)\n\tif ok {\n\t\tfmt.Println(firstValue)\n\t}\n\t// prints:\n\t//  zero\n\n\ts.Delete(7)\n\n\tsecondValue, ok := s.Get(7)\n\tif ok {\n\t\tfmt.Println(secondValue)\n\t}\n\t// prints: nothing.\n\n\ts.Set(9, \"niner\")\n\n\t// Iterate through all the elements, in order.\n\tunboundIterator := s.Iterator()\n\tfor unboundIterator.Next() {\n\t\tfmt.Printf(\"%d: %s\\n\", unboundIterator.Key(), unboundIterator.Value())\n\t}\n\t// prints:\n\t//  0: zero\n\t//  1: one\n\t//  3: three\n\t//  5: five\n\t//  9: niner\n\t//  10: ten\n\n\tfor unboundIterator.Previous() {\n\t\tfmt.Printf(\"%d: %s\\n\", unboundIterator.Key(), unboundIterator.Value())\n\t}\n\t//  9: niner\n\t//  5: five\n\t//  3: three\n\t//  1: one\n\t//  0: zero\n\n\tboundIterator := s.Range(3, 10)\n\t// Iterate only through elements in some range.\n\tfor boundIterator.Next() {\n\t\tfmt.Printf(\"%d: %s\\n\", boundIterator.Key(), boundIterator.Value())\n\t}\n\t// prints:\n\t//  3: three\n\t//  5: five\n\t//  9: niner\n\n\tfor boundIterator.Previous() {\n\t\tfmt.Printf(\"%d: %s\\n\", boundIterator.Key(), boundIterator.Value())\n\t}\n\t// prints:\n\t//  5: five\n\t//  3: three\n\n\tvar iterator skiplist.Iterator\n\n\titerator = s.Seek(3)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t//  3: three\n\n\titerator = s.Seek(2)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t//  3: three\n\n  iterator = s.SeekToFirst()\n  fmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n  // prints:\n  //  0: zero\n\n  iterator = s.SeekToLast()\n  fmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n  // prints:\n  //  10: ten\n\n  // SkipList can also reduce subsequent forward seeking costs by reusing the\n  // same iterator:\n\n  iterator = s.Seek(3)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t//  3: three\n\n  iterator.Seek(5)\n\tfmt.Printf(\"%d: %s\\n\", iterator.Key(), iterator.Value())\n\t// prints:\n\t//  5: five\n}\n```\n\nFull documentation\n==================\n\nRead it [online](http://godoc.org/github.com/ryszard/goskiplist/skiplist) or run\n\n    $ go doc github.com/ryszard/goskiplist/skiplist\n\nOther implementations\n=====================\n\nThis list is probably incomplete.\n\n\n  * https://github.com/huandu/skiplist\n  * https://bitbucket.org/taruti/go-skip/src\n  * http://code.google.com/p/leveldb-go/source/browse/leveldb/memdb/memdb.go\n  (part of [leveldb-go](http://code.google.com/p/leveldb-go/))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryszard%2Fgoskiplist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryszard%2Fgoskiplist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryszard%2Fgoskiplist/lists"}