{"id":13511565,"url":"https://github.com/BonzaiThePenguin/WikiSort","last_synced_at":"2025-03-30T20:33:45.356Z","repository":{"id":14378082,"uuid":"17088192","full_name":"BonzaiThePenguin/WikiSort","owner":"BonzaiThePenguin","description":"Fast and stable sort algorithm that uses O(1) memory. Public domain.","archived":false,"fork":false,"pushed_at":"2021-12-14T02:46:28.000Z","size":1756,"stargazers_count":1267,"open_issues_count":7,"forks_count":95,"subscribers_count":50,"default_branch":"master","last_synced_at":"2024-10-23T06:58:31.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BonzaiThePenguin.png","metadata":{"files":{"readme":"README.md","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":"2014-02-22T16:02:13.000Z","updated_at":"2024-09-24T08:49:09.000Z","dependencies_parsed_at":"2022-09-05T14:31:55.821Z","dependency_job_id":null,"html_url":"https://github.com/BonzaiThePenguin/WikiSort","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/BonzaiThePenguin%2FWikiSort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BonzaiThePenguin%2FWikiSort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BonzaiThePenguin%2FWikiSort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BonzaiThePenguin%2FWikiSort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BonzaiThePenguin","download_url":"https://codeload.github.com/BonzaiThePenguin/WikiSort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222119868,"owners_count":16934949,"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-08-01T03:00:57.283Z","updated_at":"2024-11-01T13:31:14.794Z","avatar_url":"https://github.com/BonzaiThePenguin.png","language":"C++","funding_links":[],"categories":["C++","VII. Other"],"sub_categories":["1. Source code examples"],"readme":"WikiSort\n======\nWikiSort is an implementation of \"block merge sort\", which is a stable merge sort based on the work described in [\"Ratio based stable in-place merging\", by Pok-Son Kim and Arne Kutzner](https://github.com/BonzaiThePenguin/WikiSort/blob/master/tamc2008.pdf) [PDF]. It's generally as fast as a standard merge sort while using O(1) memory, and can be modified to use additional memory optionally provided to it which can further improve its speed.\n\n[C](https://github.com/BonzaiThePenguin/WikiSort/blob/master/WikiSort.c), [C++](https://github.com/BonzaiThePenguin/WikiSort/blob/master/WikiSort.cpp), and [Java](https://github.com/BonzaiThePenguin/WikiSort/blob/master/WikiSort.java) versions are currently available, and you have permission from me and the authors of the paper (Dr. Kim and Dr. Kutzner) to [do whatever you want with this code](https://github.com/BonzaiThePenguin/WikiSort/blob/master/LICENSE).\n\n**Related:** Check out the [GrailSort project](https://github.com/Mrrl/GrailSort) for a similar algorithm based on a paper by Huang and Langston, or the [Rewritten Grailsort project](https://github.com/MusicTheorist/Rewritten-Grailsort) which continues its work.\n\n* * *\n\n**If you want to learn how it works, check out the documentation:**\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;• [Chapter 1: Tools](https://github.com/BonzaiThePenguin/WikiSort/blob/master/Chapter%201.%20Tools.md)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;• [Chapter 2: Merging](https://github.com/BonzaiThePenguin/WikiSort/blob/master/Chapter%202.%20Merging.md)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;• [Chapter 3: In-Place](https://github.com/BonzaiThePenguin/WikiSort/blob/master/Chapter%203.%20In-Place.md)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;• [Chapter 4: Faster!](https://github.com/BonzaiThePenguin/WikiSort/blob/master/Chapter%204.%20Faster!.md)\n\nOr you can check out the [Wikipedia page](https://en.wikipedia.org/wiki/Block_Sort) for block merge sort. WikiSort was actually (poorly) named out of the hope that you'll update and improve its various components almost like a Wikipedia article, since this is still very much an open area of research that could use your expertise!\u003cbr/\u003e\n\n* * *\n\n**WikiSort vs. std::stable_sort()**  \n\u003csup\u003e(clang++ version 3.2, sorting 0 to 1.5 million items)\u003c/sup\u003e\n\nUsing a 512-item fixed-size cache for O(1) memory:\n\n    Test             Fast comparisons   Slow comparisons   150,000,000 items    0-32 items\n    Random               6% faster        95% as fast         35% faster        45% faster\n    RandomFew            5% faster        16% faster          20% faster        45% faster\n    MostlyDescending    97% as fast       13% faster          99% as fast       53% faster\n    MostlyAscending    149% faster       117% faster         286% faster        47% faster\n    Ascending         1280% faster       518% faster        1101% faster       242% faster\n    Descending          23% faster       121% faster          12% faster       164% faster\n    Equal             1202% faster       418% faster        1031% faster       227% faster\n    Jittered           526% faster       298% faster         733% faster        70% faster\n    MostlyEqual         15% faster        57% faster          10% faster        42% faster\n    Append             153% faster        90% faster         348% faster       112% faster\n\nUsing a dynamically allocated half-size cache:\n\n    Test             Fast comparisons   Slow comparisons\n    Random              11% faster         3% faster\n    RandomFew           10% faster         5% faster\n    MostlyDescending    19% faster        26% faster\n    MostlyAscending     98% faster        79% faster\n    Ascending          861% faster       463% faster\n    Descending          39% faster       142% faster\n    Equal              837% faster       460% faster\n    Jittered           326% faster       243% faster\n    MostlyEqual         15% faster         2% faster\n    Append             159% faster        94% faster\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBonzaiThePenguin%2FWikiSort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBonzaiThePenguin%2FWikiSort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBonzaiThePenguin%2FWikiSort/lists"}