Skip to main content

Sortify

Project Description


sortify is a Python package containing implementations of different sorting algorithms. This module is implemented using vanilla Python and does not need any additional dependencies.

Installation


Simply run the following command in the terminal to install sortify:

pip install sortify

Usage


The following example demonstrates how you can use sortify:

from sortify import Sort

if __name__ == "__main__":
    arr = [1, 7, 2, 6, 3, 5, 4]
    print(Sort.bubble(arr))

This prints the following result:

[1, 2, 3, 4, 5, 6, 7]

The available sorting methods are:

  • Sort.bubble(arr: list, reverse: bool) → Bubble sort
  • Sort.insertion(arr: list, reverse: bool) → Insertion sort
  • Sort.selection(arr: list, reverse: bool) → Selection sort
  • Sort.quick(arr: list, reverse: bool) → Quick sort
  • Sort.mergesort(arr: list, reverse: bool) → Merge sort

Here, set the parameter reverse = True to sort the list in descending order. For example:

from sortify import Sort

if __name__ == "__main__":
    arr = [1, 7, 2, 6, 3, 5, 4]
    print(Sort.merge(arr, reverse=False))

This prints the following result:

[7, 6, 5, 4, 3, 2, 1]

Download files

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

Source Distribution

sortify-1.2.1.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file sortify-1.2.1.tar.gz.

File metadata

  • Download URL: sortify-1.2.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for sortify-1.2.1.tar.gz
Algorithm Hash digest
SHA256 7680876cb53f362b5aba567976493ad4b76ffb24cc43c920c38bb5fa00181dd1
MD5 8906a1965cc0983117bd0ed36c5362db
BLAKE2b-256 d4a0256fea20d0a66d12214eb62e2882d33d0a6ce1cd86e840231ed5a794eafa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.1 This release

1 file

1.2

1 file

1.1

1 file

1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page