Skip to main content

A Python library implementing various sorting algorithms

Project description

Here's your updated README with a functionality chart included for better clarity:


SortKit - A Python Sorting Library

SortKit is a Python library that provides efficient implementations of various sorting algorithms. This package allows users to easily sort lists and CSV data using different sorting techniques.

Features

✅ Supports multiple sorting algorithms:

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Quick Sort
  • Merge Sort
  • Heap Sort
  • Counting Sort (for numerical values)

✅ Supports integers, floating-point numbers, and strings
✅ Can sort data from CSV files
✅ Simple and efficient API
✅ Well-tested with unittest

Installation

Install SortKit using pip:

pip install sortkit

Functionality Chart

Function Name Sorting Type Description Example Usage
bubble_sort() Bubble Sort Simple, compares adjacent elements bubble_sort(arr)
selection_sort() Selection Sort Selects the smallest and swaps selection_sort(arr)
insertion_sort() Insertion Sort Builds sorted list one item at a time insertion_sort(arr)
quick_sort() Quick Sort Efficient, divide and conquer approach quick_sort(arr)
merge_sort() Merge Sort Splits, sorts, and merges lists merge_sort(arr)
heap_sort() Heap Sort Uses heap structure to sort data heap_sort(arr)
counting_sort() Counting Sort Efficient for small integer ranges counting_sort(arr)
csv_sort() CSV Sorting Sorts a CSV file by a given column csv_sort("file.csv", column_index=1)

Usage

Example 1: Sorting a List with Bubble Sort

from sortkit import bubble_sort

arr = [5, 3, 8, 6, 2, 7, 4, 1]

sorted_arr = bubble_sort(arr)
print(sorted_arr)  # Output: [1, 2, 3, 4, 5, 6, 7, 8]

Example 2: Sorting a CSV File by a Specific Column

from sortkit import csv_sort

csv_file = "data.csv"  # Your CSV file path
sorted_data = csv_sort(csv_file, column_index=1)  # Sorting by second column

for row in sorted_data:
    print(row)

Running Tests

To run tests, use the following command:

python -m unittest discover tests

Or

py -m unittest discover tests

Contributing

If you'd like to contribute, feel free to fork the repository and submit a pull request.

License

This project is licensed under the MIT License.


🚀 Now with a clear function reference chart! Let me know if you need more improvements. 😊

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

sortkit-0.1.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sortkit-0.1.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file sortkit-0.1.1.tar.gz.

File metadata

  • Download URL: sortkit-0.1.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for sortkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4d9e5e736c5f325d638e517f14e11952ea48430c945cf7e5629804229c1c9c2
MD5 06862e1d5d1c642c287ce9b0a5e6d1a2
BLAKE2b-256 1fb702fdf8a1fe62350e6e6062051895146190f35d9d17f5d36c5e1a5b6ea5f5

See more details on using hashes here.

File details

Details for the file sortkit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sortkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for sortkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3128ed6f8d574f60c2935ffc2785ecd283e6ee0de26313dabc0493cc1f60d15
MD5 5c660051726e88ef4d138815c167b938
BLAKE2b-256 2043a180233c31e2c9fb09aef0a2d04a76616eee27cdb018d9dfa4608c8fddc3

See more details on using hashes here.

Supported by

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