Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wasteland_sort-1.1.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

wasteland_sort-1.1.0-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page