Pacote Python com vários algoritmos de ordenação e busca
Project description
# sortinpy
Python library providing a collection of classic sorting and searching algorithms implemented from scratch. Designed for educational purposes and practical use in Python projects.
## Installation
To install the package locally for development or usage, navigate to the project root folder (where `setup.py` is located) and run:
```bash
pip install -e .
This installs the library in editable mode, so any changes you make to the source code will reflect immediately.
Usage
Import the specific sorting or searching function you need from sortinpy and use it on your lists.
Example with sorting algorithms:
import sortinpy
lst = [5, 3, 2, 8, 1]
# Simple use returning just the sorted list
sorted_list = sortinpy.bubble_sort(lst)
print("Bubble Sort:", sorted_list)
# Using a function with optional statistics output
sorted_list, stats = sortinpy.shell_sort(lst, stats=True)
print("Shell Sort:", sorted_list)
print("Operation counts:", stats)
Available Algorithms
Sorting Algorithms
- Bubble Sort — simple, inefficient, good for learning
- Insertion Sort — simple, efficient on nearly sorted data
- Selection Sort — simple, always O(n²)
- Merge Sort — efficient, stable divide and conquer
- Quick Sort — efficient average case, recursive
- Heap Sort — efficient, in-place, uses heap data structure
- Counting Sort — efficient for integers in small range
- Radix Sort — non-comparative sort for integers
- Shell Sort — optimized insertion sort with gap sequence
- Bogo Sort — educational, randomized and very inefficient
- Introsort — hybrid of quicksort and heapsort for efficiency
Searching Algorithms
- Binary Search — fast search on sorted lists
- Linear Search — simple search for any list
- Lower Bound — finds insertion position (left)
- Upper Bound — finds insertion position (right)
Optional Statistics
Most sorting functions accept an optional boolean parameter (stats=True) that makes them return a tuple: the sorted list plus a dictionary containing counts of:
- Comparisons
- Swaps
- Assignments
This allows analyzing algorithm performance on given inputs.
License
This project is licensed under the MIT License — see the LICENSE file for full details.
Created by wandsondev
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sortinpy-0.1.0.tar.gz.
File metadata
- Download URL: sortinpy-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4fb254718841ae383d67d82b59247e338edd1e85e6f4870b315c5fa662fd9c9
|
|
| MD5 |
ed6ef73cb6474c5edba538e7d9eeb43f
|
|
| BLAKE2b-256 |
625efecd6681ba5dea1b080b965d1e957c3f59102d75c536480ec10ac3ac6799
|
File details
Details for the file sortinpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sortinpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bfd761e2844ce32e611312145ac14aff160383d8788606e1315791fe56651a3
|
|
| MD5 |
5c1fffadebebfc4d5509d4fc570ea772
|
|
| BLAKE2b-256 |
68f0b2a8faa694b2d90bf5cc4a5defdc03e87d059b8cb27fc5d1dad6db84b4a2
|