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.2.tar.gz (9.9 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.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sortkit-0.1.2.tar.gz
  • Upload date:
  • Size: 9.9 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.2.tar.gz
Algorithm Hash digest
SHA256 4950bdbc7eaa8bc643cbfd739a83c41e7297d1c7775a487ab1ac3f70ecc2e541
MD5 408b7787b7609fb6ba4ee0c8ee488cdb
BLAKE2b-256 cbe919182dfc5527d7de90ec54462fb12f205599107069c74388c71976db5553

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sortkit-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8cfc54ce624b4713dc2f80d2c208a48c5abe2f5584d5a4c2479c2b31548445ca
MD5 23ad16a288ff239c573c9f57d0e1f28c
BLAKE2b-256 bf44b9023e91999fc091c93b057c35276fb71e72152a431afa72f4604e1181b9

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