{"id":15444228,"url":"https://github.com/yoloftw/bad-sorting","last_synced_at":"2026-01-27T09:17:05.641Z","repository":{"id":238941231,"uuid":"748694792","full_name":"YoloFTW/Bad-Sorting","owner":"YoloFTW","description":"All the worst ways to sort arrays","archived":false,"fork":false,"pushed_at":"2024-05-09T20:42:09.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T14:10:37.337Z","etag":null,"topics":["bogosort","java-script","nodejs","npm","sorting-algorithms"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@yoloftw/bad-sorting","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YoloFTW.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-26T15:05:37.000Z","updated_at":"2024-05-09T20:42:13.000Z","dependencies_parsed_at":"2024-05-09T02:39:48.511Z","dependency_job_id":"b46efb87-aec4-4b65-a5d8-7426cb16032d","html_url":"https://github.com/YoloFTW/Bad-Sorting","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.1333333333333333,"last_synced_commit":"a3c7d71abc1e2af29ec502e6ca2f29b60d8afdfe"},"previous_names":["yoloftw/bad-sorting"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoloFTW%2FBad-Sorting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoloFTW%2FBad-Sorting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoloFTW%2FBad-Sorting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoloFTW%2FBad-Sorting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YoloFTW","download_url":"https://codeload.github.com/YoloFTW/Bad-Sorting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239993879,"owners_count":19730778,"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":["bogosort","java-script","nodejs","npm","sorting-algorithms"],"created_at":"2024-10-01T19:39:53.015Z","updated_at":"2026-01-27T09:17:00.616Z","avatar_url":"https://github.com/YoloFTW.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003eBad-Sorting\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\n[![GitHub Issues](https://img.shields.io/github/issues/YoloFTW/Bad-Sorting.svg)](https://github.com/YoloFTW/Bad-Sorting/issues)\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/YoloFTW/Bad-Sorting.svg)](https://github.com/YoloFTW/Bad-Sorting/pulls)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\n\n\u003c/div\u003e\n\n---\n\n## Table of Contents\n\n- [About](#about)\n\n- [Installing](#Installing)\n\n- [Usage](#usage)\n    - [Bogo Sort](#Bogo-Sort)\n    - [Communism Sort](#Communism-Sort)\n    - [Intelligent Sort](#Intelligent-Sort)\n    - [Miracle Sort](#Miracle-Sort)\n    - [Quantum Bogo Sort](#Quantum-Bogo-Sort)\n    - [Sleep Sort](#Sleep-Sort)\n\n- [Disclaimer](#Disclaimer)\n\n- [Authors](#authors)\n\n\u003c/br\u003e\n\n## About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\nTired of your wimpy sorting algorithms getting the job done too darn fast? Or maybe you're fed up of reaching for that elusive O(1) algorithim. Well you should try Bad-Sorting! the npm package for those who like their sorts served with the heat death of the universe!\n\nThis glorious collection of terrible, horrible, no good, very bad sorting techniques (affectionately called \"algorithms\") is guaranteed to modify your data. For better or for worse\n\nWhy Bad-Sorting?\n\n- Because why not? Normality is so boring.\n- Need a good laugh? Watch your CPU cry as it wrestles with bogosort.\n- Busy day? Multi-Task as your computer sleep sorts!\n\n\n\u003c/br\u003e\n\n## Installing \u003ca name =\"Installing\"\u003e\u003c/a\u003e\n\nFor Installation With NPM\n\n```shell\nnpm i @yoloftw/bad-sorting\n```\n\u003c/br\u003e\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\nSure, you installed Bad-Sorting, but how do you use it? Don't worry, I've got you covered.\n\n\u003c/br\u003e\n\nFirst things first you've got pick your poison and import it into your project. \n\n```js\nconst { BogoSort } = require('@yoloftw/bad-sorting');\n```\n\n\u003c/br\u003e\n\nThe next step is to question your life choises that brought you to this moment in time.\n\n\u003c/br\u003e\n\nLast but not least **SORT**\n```js\nlet arr = [7, 2, 20, 5, 15, 3];\n\nlet sorted = BogoSort(arr);\n\nconsole.log(sorted);\n//expected output: [2, 3, 5, 7, 15, 20]\n```\n\u003c/br\u003e\n\n## Bogo Sort \u003ca name=\"Bogo-Sort\"\u003e\u003c/a\u003e\n\nAh, Bogo Sort, the algorithm that embodies the spirit of \"throw it at the wall and see if it sticks\". Bogo Sort does away with the hard work of itterating over an array and offloads the sorting to the checking algorithim by randomising the array until it is sorted. Heres how to use it.\n\n```js\nconst { BogoSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [5, 18, 3, 8, 14, 2, 13, 16];\n\nlet sorted = BogoSort(arr);\n\nconsole.log(sorted);\n//expected output: [2, 3, 5, 8, 13, 14, 16, 18]\n```\n\nBogosort boasts a time complexity of O(n * n!), which basically means it could take longer than the life expectancy of the universe to sort a moderately sized list.\n\n\u003c/br\u003e\n\n## Communism Sort \u003ca name=\"Communism-Sort\"\u003e\u003c/a\u003e\n\nIn a communist array everyone is equal. Communism Sort redistributes the wealth to the less fortunate elements resulting in an array that is perfectly equal and therefore sorted. \n\n```js\nconst { CommunismSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [1, 6, 4, 10, 13];\n\nlet sorted = CommunismSort(arr);\n\nconsole.log(sorted);\n//expected output: [ 6.8, 6.8, 6.8, 6.8, 6.8 ]\n```\n\nCommunism Sort achieves a time complexity of O(n), a testament to the efficiency of collective action!\n\n\u003c/br\u003e\n\n## Intelligent Sort \u003ca name=\"Intelligent-Sort\"\u003e\u003c/a\u003e\n\nCredit Goes to [David Morgan-Mar's Esoteric Algorithims page](https://www.dangermouse.net/esoteric/)\n\nFrom the [Intelligent Sort page](https://www.dangermouse.net/esoteric/intelligentdesignsort.html) \n\n\u003eThe probability of the original input list being in the exact order it's in is 1/(n!). There is such a small likelihood of this that it's clearly absurd to say that this happened by chance, so it must have been consciously put in that order by an intelligent Sorter. Therefore it's safe to assume that it's already optimally Sorted in some way that transcends our naïve mortal understanding of \"ascending order\". Any attempt to change that order to conform to our own preconceptions would actually make it less sorted.\n\n```js\nconst { IntelligentSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [13, 16, 4, 8, 3, 14, 2];\n\nlet sorted = IntelligentSort(arr);\n\nconsole.log(sorted);\n//expected output: [13, 16, 4, 8, 3, 14, 2]\n```\n\nIntelligent Sort is one of those elusive constant time algorithims and therefore has the gift of O(1) time complexity.\n\n\u003c/br\u003e\n\n\n## Miracle Sort \u003ca name=\"Miracle-Sort\"\u003e\u003c/a\u003e\n\nMiracle Sort embraces the power of chance (and cosmic rays) to achieve the impossible. Miracle Sort waits for cosmic rays to flip enough bits in memory for the array to be sorted. \n\n```js\nconst { MiracleSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [13, 16, 4, 8, 3, 14, 2];\n\nlet sorted = MiracleSort(arr);\n\nconsole.log(sorted);\n//expected output: [2, 3, 4, 8, 13, 14, 16]\n```\n\nDue to Miracle Sort waiting for, well, a miracle the time complexity is a staggering O(∞).\n\n\u003c/br\u003e\n\n## Quantum Bogo Sort \u003ca name=\"Quantum-Bogo-Sort\"\u003e\u003c/a\u003e\n\nQuantum Bogo Sort assumes that Hugh Everett guy was correct that that there are infact infinite parrallel universes. Quantum Bogo Sort checks if the array is sorted and if not destroys the universe. The only remaining universe is where the array is sorted\n\n```js\nconst { QuantumBogoSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [6, 19, 5, 1, 3, 8];\n\nlet sorted = QuantumBogoSort(arr);\n\nconsole.log(sorted);\n//expected output: [1, 3, 5, 6, 8, 19]\n```\n\nIn the universe where the array was sorted, it was only checked once. Therefore we have another example of a coverted O(1) algorithim\n\n\u003c/br\u003e\n\n## Sleep Sort \u003ca name=\"Sleep-Sort\"\u003e\u003c/a\u003e\n\nSleep Sort takes a laid-back approach to sorting. Instead of furiously comparing elements it takes a step back and waits for the problem to sort itself.\n\n```js\nconst { SleepSort } = require('@yoloftw/bad-sorting');\n\nlet arr = [7, 2, 20, 5, 15, 3];\n\nlet sorted = SleepSort(arr);\n\nconsole.log(sorted);\n//expected output: [2, 3, 5, 7, 15, 20]\n```\n\nSleep Sorts time complexity is a tough one as unlike other algorithims that are dependent on array size, Sleep Sort is dependent on the biggest element. Due to this Sleep Sorts time complexity is O(max(input))\n\n\u003c/br\u003e\n\n## Disclaimer \u003ca name = \"Disclaimer\"\u003e\u003c/a\u003e\n\nThese sorting systems utilize highly experimental and down right questionable *\"algorithms\"*. Potential side effects include interdimensional tears, sentient toaster uprisings, and a mild case of the Mondays. Use at your own risk. We're not responsible for any existential crises caused by questioning the nature of sorting after using Bad-Sorting.\n\n\u003c/br\u003e\n\n## Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\n\n- [@YoloFTW](https://github.com/YoloFTW)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoloftw%2Fbad-sorting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoloftw%2Fbad-sorting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoloftw%2Fbad-sorting/lists"}