{"id":19814101,"url":"https://github.com/guibrandt/multi-splay","last_synced_at":"2025-10-09T02:47:07.896Z","repository":{"id":129285853,"uuid":"355275714","full_name":"GuiBrandt/multi-splay","owner":"GuiBrandt","description":"Multi-splay tree implementation written in Go","archived":false,"fork":false,"pushed_at":"2021-04-06T17:30:16.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-30T03:08:17.891Z","etag":null,"topics":["data-structures","dynamic-optimality","go","multi-splay-tree","tree-structure"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuiBrandt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-06T17:29:43.000Z","updated_at":"2021-08-19T16:27:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"b353fd22-8935-4deb-bab0-25ab09e14926","html_url":"https://github.com/GuiBrandt/multi-splay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GuiBrandt/multi-splay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2Fmulti-splay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2Fmulti-splay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2Fmulti-splay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2Fmulti-splay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuiBrandt","download_url":"https://codeload.github.com/GuiBrandt/multi-splay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2Fmulti-splay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000769,"owners_count":26082906,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data-structures","dynamic-optimality","go","multi-splay-tree","tree-structure"],"created_at":"2024-11-12T09:38:05.113Z","updated_at":"2025-10-09T02:47:07.864Z","avatar_url":"https://github.com/GuiBrandt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Multi-Splay Tree](https://imgur.com/XKvuwDp.png)\n\n# Multi-Splay Tree\n\nThis is an implementation of a multi-splay tree, written in Go.\n\n## Multi-what tree, now?\n\nTo spare you the time of reading the paper just to have an undertanding of\nwhat the data structure might be, this section explains the main idea behind it.\n\nThe multi-splay tree is the splay-tree counterpart of [Tango Trees][tango],\nwhich are a special class of binary search trees which are proven to be\nO(log log n)-competitive on both searches and updates.\nIt makes use of red-black trees to achieve this bound, mainly by breaking\nthe tree into many smaller trees, which are governed by another (implicit)\nred-black tree, called the reference tree.\n\nThe paper for Tango Trees is available at [Erik Demaine's website][tango-paper],\nand is worth a read (it's reasonably short, too).\n\n[tango]: https://en.wikipedia.org/wiki/Tango_tree\n[tango-paper]: https://erikdemaine.org/papers/Tango_SICOMP/paper.pdf\n\nBoth the tango tree and multi-splay trees are efforts on the direction of answering \nthe [dynamic optimality conjecture][dynamic-optimality], introduced by\nSleator and Tarjan on the original splay-tree paper. Both achieve a very good bound\nof O(log log n)-competitiveness. While it keeps this bound, the multi-splay tree \nimproves on the tango tree by providing a better amortized cost for operations on\nthe tree (O(log n) instead of the O(log n log log n) achieved by tango trees). It \nis also an open problem whether the multi-splay tree is dinamically optimal, while\nthe tango tree is known not to be.\n\n[dynamic-optimality]: https://en.wikipedia.org/wiki/Optimal_binary_search_tree#Dynamic_optimality\n\nThe general construction of the multi-splay tree is represented on the following\ndiagram, which shows both the reference tree (which is an implicit red-black tree) \nas wells as the actual multi-splay tree. The splay trees on the MST correspond to\npreferred paths (paths of preferred children) on the reference tree:\n\n![Diagram 1](https://imgur.com/sMABdIx.png)\n\n## Is this practical?\n\nNo.\n\nThe constant factors associated with maintaining a multi-splay tree are _huge_, and\nhaving them on a practical setting is not viable. It is a very interesting piece of\nresearch, though, and very nice to play with.\n\n## Why?\n\nI originally wrote it in C for a college assignment (and eventually gave up on using\nit because it timed out on the automated tests, unfortunatelly).\n\nI rewrote it in Go to get used to the language.\n\n## TODO List\n- Implement deletions (the original assignment didn't require them 'w').\n- Write some tests.\n- Cleanup (?). I'm new to Go, since I mostly translated the code directly from C, \n  there might be some rough edges in it.\n\n## References\n\n[WDS06] C. C. Wang, J. Derryberry, and D. D. Sleator.\n        O(log log n)-competitive dynamic binary search trees.\n        SODA, pp. 374–383, 2006.\n        Available at https://www.cs.cmu.edu/~chengwen/paper/MST.pdf\n        Extended version available at https://pdfs.semanticscholar.org/8006/044b0a69b9d1828711ce909f3201f49c7b06.pdf.\n\n[ST85] D. D. Sleator and R. E. Tarjan.\n       Self-Adjusting Binary Search Trees.\n       Journal of the Association for Computing Machinery, Vol. 32, No. 3,\n       pp. 652-686, 1985. \n       Available at https://www.cs.cmu.edu/~sleator/papers/self-adjusting.pdf.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibrandt%2Fmulti-splay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguibrandt%2Fmulti-splay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibrandt%2Fmulti-splay/lists"}