Fully tested and documented version of the Wasteland sorting algorithm
Project description
Wasteland-sort
Wasteland sort is an O(m + n) running time sorting algorithm developed with the intention of creating a general purpose O(n) sorting algorithm.
To run the algorithm, call wasteland_sort() and pass in your array to be sorted. The sort is pseudo in-place but unstable. Any element in the array will be replaced. Currently, Wasteland sort only sorts integers, so integer representations of objects can also be sorted, though it won't be very helpful if their hashes aren't unique.
If you have questions about the algorithm, feel free to open an issue and I'll get in contact.
To import the module, you can use the statement import wasteland
. To directly access the file where wasteland_sort lives, use from wasteland import wasteland_sort
.
Example usage
from wasteland import wasteland_sort as ws
from typing import List, Tuple
x : List[int] = [645,111234,78,4,72,9,3344,1]
y : List[int] = [645,111234,78,4,72,9,3344,1]
#Calling the wasteland find_extremes() method
least, most = ws.find_extremes(x)
#Calling the wasteland sorting algorithm
ws.sort(x, True)
ws.sort(y, False)
# y = [1, 4, 9, 72, 78, 645, 3344, 111234]
# x = [111234, 3344, 645, 78, 72, 9, 4, 1]
# least = 1
# most = 111234
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
Hashes for wasteland_sort-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b86ee8b189cc433707541b415b2892f1e532b60be6be0fd35602cada1fc10614 |
|
MD5 | a9501f0501f9028337459d275a5eb0c2 |
|
BLAKE2b-256 | c9f54262cede397b29774195675840ff796c0c64d4e075d333ec4e7f239f4d79 |