primesort 1.0.0
A really stupid sorting algorithm
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
PrimeSort
This is a joke sorting algorithm which should be worse than bubble sort (and is unstable too).
I just made it for fun. Use it at your own risk.
The Idea
This is actually a pessimisation of selection sort, where we do extra work with every pass.
Given an array of length N
.
Use the prime factors of N + 1
, along with 1 and 0, as steps for various indexes (mod N
),
(which should each take some multiple of N
steps to return to 0), to sort a subset of the array
(bubble sort is simplest for the subsets).
if N + 1
is prime, use N + 2
instead, to increase the size of the subarrays.
This is not strictly necessary, but it should reduce the amount of passes.
Finally shortcut if the array is already sorted.
- 1.0.0 released 10 months ago
- phebert5009/PrimeSort
- proprietary
- Copyright © 2024, phebert5009
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.0 2024-Feb-12 ~stable 2024-Feb-12 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
1 downloads total
-
- Score:
- 0.3
- Short URL:
- primesort.dub.pm