No project description provided
Project description
Topic: "Mogussort" Author: "구FS"
Mogussort
1. 📮Mogussort
World's (📮)SUSSIEST sorting algorithm
2. 📮Lore📮
Your normal and boring sorting algorithms are just too fast? You want to introduce some sussy code to your programs?
Then you have come to the right place.
Inspired by the fantastic Csussus version and certified 📮extra sussy📮 by the original author!
3. Installation
You can install 📮Mogussort📮 from PyPi with pip install Mogussort
.
4. 📮How it works📮
There are 2 (two, 2📮) lists, crew_in
and crew_out
.
crew_in
contains all crewmates at the start of the game.crew_out
is empty.
The algorithm will vote out one random crewmate and put it in crew_out
That crewmate is then removed from crew_in
. Then, it checks if crew_out
is correctly sorted (ascending).
If it is correnct, it will continue to vote and populate crew_out
.
If the crewmates are not in the right order an 📮Impostor📮 (sus, baka) has been spotted. This means that the game is lost, and crew_out
will be cleared, and crew_in
will be reset to the original form.
The algorithm will stop once all crewmates are in the right order.
5. 📮Performance📮
The 📮mogussort solves all of your sorting problems with an incredible, luck based runtime. You might ask "how fast is it exactly?".
Well, having $c$ crew mates the probability $p$ of sorting voting correctly in $1$ attempts to sort emergency meeting is:
$$ \begin{align} p&=\frac{1}{c} \cdot \frac{1}{c-1} \cdot \frac{1}{c-2} \cdot ... \cdot \frac{1}{1} \ &=\frac{1}{c!} \end{align} $$
That means the probability to fail in $1$ emergency meeting is:
$$ \begin{align} 1-p=1- \frac{1}{c!} \end{align} $$
If we make $n$ emergency meetings, the chance $P$ of $1$ success is:
$$ \begin{align} P&=1-(1-p)^{n} \ &=1-(1- \frac{1}{c!})^{n} \end{align} $$
So, how many meetings do we need until we have a chance of $P$ to have them sorted correctly once?
$$ \begin{align} P &= 1-(1- \frac{1}{c!})^{n}\ (1- \frac{1}{c!})^{n} &= 1-P \ n &= \text{log}_{1- \frac{1}{c!}}(1-P) \ n &= \frac{\text{lg}(1-P)}{\text{lg}(1- \frac{1}{c!})} \end{align} $$
So if we manage $m$ meetings per second, mogussort will finish with a probability $P$ within time $t_{P}$:
$$ \begin{align} t_{P} &= \frac{n}{m} \ &= \frac{\text{lg}(1-P)}{\text{lg}(1- \frac{1}{c!})} \cdot \frac{1}{m} \end{align} $$
Let's assume we manage $m=60 \text{k} \frac{\text{meeting}}{\text{s}}$ , which is a value I roughly get on my computer (Intel Core i7-8550U). Then mogussort will finish with a probability $P$ of $0,50$ and $0,95$ within:
Crew Mates $c$ | Time $t_{0,50}$ | Time $t_{0,50}$ | Time $t_{0,95}$ | Time $t_{0,95}$ |
---|---|---|---|---|
$2$ | $16,67 \text{µs}$ | $72,03 \text{µs}$ | ||
$3$ | $63,36 \text{µs}$ | $273,9 \text{µs}$ | ||
$4$ | $271,4 \text{µs}$ | $1,173 \text{ms}$ | ||
$5$ | $1,381 \text{ms}$ | $5,966 \text{ms}$ | ||
$6$ | $8,312 \text{ms}$ | $35,92 \text{ms}$ | ||
$7$ | $58,22 \text{ms}$ | $251,6 \text{ms}$ | ||
$8$ | $465,8 \text{ms}$ | $2,013 \text{s}$ | ||
$9$ | $4,192 \text{s}$ | $18,12 \text{s}$ | ||
$10$ | $41,92 \text{s}$ | $181,2 \text{s}$ | $(3,0 \text{min})$ | |
$11$ | $461,1 \text{s}$ | $(7,7 \text{min})$ | $1,993 \text{ks}$ | $(33 \text{min})$ |
$12$ | $5,534 \text{ks}$ | $(1,5 \text{h})$ | $23,92 \text{ks}$ | $(6,6 \text{h})$ |
$13$ | $71,94 \text{ks}$ | $(20 \text{h})$ | $310,9 \text{ks}$ | $(3,6 \text{d})$ |
$14$ | $1,007 \text{Ms}$ | $(12 \text{d})$ | $4,353 \text{Ms}$ | $(50 \text{d})$ |
$15$ | $15,11 \text{Ms}$ | $(170 \text{d})$ | $65,29 \text{Ms}$ | $(2,1 \text{a})$ |
$16$ | $242,0 \text{Ms}$ | $(7,7 \text{a})$ | $1,046 \text{Gs}$ | $(33 \text{a})$ |
$17$ | $4,162 \text{Gs}$ | $(132 \text{a})$ | $17,99 \text{Gs}$ | $(570 \text{a})$ |
$18$ | $104,1 \text{Gs}$ | $(3.297 \text{a})$ | $449,7 \text{Gs}$ | $(14.251 \text{a})$ |
This even means you might be able to play a game of Among Us while you wait for the algorithm to finish (now isn't that fantastic?).
6. 📮Sus📮
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⣀⣀⣐⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⢠⠄⣠⣶⣿⣿⣿⠿⠿⣛⣂⣀⣀⡒⠶⣶⣤⣤⣬⣀⡀⠄⢀⠄⠄⠄⠄⠄⠄⠄
⠄⠄⢀⣾⣿⣿⣿⡟⢡⢾⣿⣿⣿⣿⣿⣿⣶⣌⠻⣿⣿⣿⣿⣷⣦⣄⡀⠄⠄⠄⠄⠄
⠄⠄⣈⣉⡛⣿⣿⣿⡌⢇⢻⣿⣿⣿⣿⣿⠿⠛⣡⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⠄
⠄⠺⠟⣉⣴⡿⠛⣩⣾⣎⠳⠿⠛⣋⣩⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠄⠄
⠄⠄⠄⠘⢋⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄
⠄⠄⢀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄
⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⣀
⠄⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠛
⠄⠄⠄⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⣀⣀⣠⣤
⠄⠄⣀⣀⡙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢛⣩⠤⠾⠄⠛⠋⠉⢉
⠄⠺⠿⠛⠛⠃⠄⠉⠙⠛⠛⠻⠿⠿⠿⠟⠛⠛⠛⠉⠁⠄⠄⣀⣀⣠⣤⣠⣴⣶⣼⣿
⠀⠀⠀⡯⡯⡾⠝⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢊⠘⡮⣣⠪⠢⡑⡌
⠀⠀⠟⠝⠈⠀⠀⠀⠡⠀⠠⢈⠠⢐⢠⢂⢔⣐⢄⡂⢔⠀⡁⢉⠸⢨⢑⠕⡌
⠀⠀⡀⠁⠀⠀⠀⡀⢂⠡⠈⡔⣕⢮⣳⢯⣿⣻⣟⣯⣯⢷⣫⣆⡂⠀⠀⢐⠑⡌
⢀⠠⠐⠈⠀⢀⢂⠢⡂⠕⡁⣝⢮⣳⢽⡽⣾⣻⣿⣯⡯⣟⣞⢾⢜⢆⠀⡀⠀⠪
⣬⠂⠀⠀⢀⢂⢪⠨⢂⠥⣺⡪⣗⢗⣽⢽⡯⣿⣽⣷⢿⡽⡾⡽⣝⢎⠀⠀⠀⢡
⣿⠀⠀⠀⢂⠢⢂⢥⢱⡹⣪⢞⡵⣻⡪⡯⡯⣟⡾⣿⣻⡽⣯⡻⣪⠧⠑⠀⠁⢐
⣿⠀⠀⠀⠢⢑⠠⠑⠕⡝⡎⡗⡝⡎⣞⢽⡹⣕⢯⢻⠹⡹⢚⠝⡷⡽⡨⠀⠀⢔
⣿⡯⠀⢈⠈⢄⠂⠂⠐⠀⠌⠠⢑⠱⡱⡱⡑⢔⠁⠀⡀⠐⠐⠐⡡⡹⣪⠀⠀⢘
⣿⣽⠀⡀⡊⠀⠐⠨⠈⡁⠂⢈⠠⡱⡽⣷⡑⠁⠠⠑⠀⢉⢇⣤⢘⣪⢽⠀⢌⢎
⣿⢾⠀⢌⠌⠀⡁⠢⠂⠐⡀⠀⢀⢳⢽⣽⡺⣨⢄⣑⢉⢃⢭⡲⣕⡭⣹⠠⢐⢗
⣿⡗⠀⠢⠡⡱⡸⣔⢵⢱⢸⠈⠀⡪⣳⣳⢹⢜⡵⣱⢱⡱⣳⡹⣵⣻⢔⢅⢬⡷
⣷⡇⡂⠡⡑⢕⢕⠕⡑⠡⢂⢊⢐⢕⡝⡮⡧⡳⣝⢴⡐⣁⠃⡫⡒⣕⢏⡮⣷⡟
⣷⣻⣅⠑⢌⠢⠁⢐⠠⠑⡐⠐⠌⡪⠮⡫⠪⡪⡪⣺⢸⠰⠡⠠⠐⢱⠨⡪⡪⡰
⣯⢷⣟⣇⡂⡂⡌⡀⠀⠁⡂⠅⠂⠀⡑⡄⢇⠇⢝⡨⡠⡁⢐⠠⢀⢪⡐⡜⡪⡊
⣿⢽⡾⢹⡄⠕⡅⢇⠂⠑⣴⡬⣬⣬⣆⢮⣦⣷⣵⣷⡗⢃⢮⠱⡸⢰⢱⢸⢨⢌
⣯⢯⣟⠸⣳⡅⠜⠔⡌⡐⠈⠻⠟⣿⢿⣿⣿⠿⡻⣃⠢⣱⡳⡱⡩⢢⠣⡃⠢⠁
⡯⣟⣞⡇⡿⣽⡪⡘⡰⠨⢐⢀⠢⢢⢄⢤⣰⠼⡾⢕⢕⡵⣝⠎⢌⢪⠪⡘⡌
⡯⣳⠯⠚⢊⠡⡂⢂⠨⠊⠔⡑⠬⡸⣘⢬⢪⣪⡺⡼⣕⢯⢞⢕⢝⠎⢻⢼⣀
⠁⡂⠔⡁⡢⠣⢀⠢⠀⠅⠱⡐⡱⡘⡔⡕⡕⣲⡹⣎⡮⡏⡑⢜⢼⡱⢩⣗⣯⣟
7. Language
Made in py📮sus📮 to improve performance in comparison to the original Csussus version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mogussort-1.0.3.tar.gz
.
File metadata
- Download URL: mogussort-1.0.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f43ac4c60806f7f2a3d52e27430c574c8b174159037e21fa875a163475f4204e |
|
MD5 | f8c5919ee3da26ed5d2413c02b57a68f |
|
BLAKE2b-256 | 498b107b9f2aec3f29a2e8d176fb81c2037ccf6f16be01f6065ae03cc9c5ae3d |
File details
Details for the file mogussort-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: mogussort-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c74f758d915f7c2143898f25fa866b16c9be915cd1398540d2e7136d1d6dc70e |
|
MD5 | de44a039951a398cf1bfc912ba1b2ece |
|
BLAKE2b-256 | fd65984d9e73fcb09faf7b8921e61c2bf6ada617f8df9c720049183a9f1ac538 |