Python module for easiest and fast sort
Project description
Sorting Module in Python
This Python module provides implementations of several sorting algorithms. The current version includes the following sorting algorithms:
- Bubble Sort
- Merge Sort
- Quick Sort
- Insertion Sort
- Heap Sort
- Shell Sort
- Partial Sort
How to install and import module
To install the module, you need to write in the terminal.
pip install easiest_sort
To import the module, you need to write in your Python file
from easiest_sort import *
Bubble Sort
Use Case: Simplicity and ease of understanding. Suitable for small data sets or educational purposes. Inefficient for large data sets due to quadratic complexity.
from easiest_sort import bubble_sort
my_list = []
bubble_sort(my_list)
Merge Sort
Use Case: Efficient sorting for large data sets. Relatively stable and well-suited for lists that do not fit entirely in memory
from easiest_sort import merge_sort
my_list = []
merge_sort(my_list)
Quick Sort
Use Case: High efficiency on average and large data sets. Demonstrates good practical performance. Used in various domains, including programming languages and databases.
from easiest_sort import quick_sort
my_list = []
quick_sort(my_list)
Insertion Sort
Use Case: Effective for small or partially ordered data. Convenient when adding new elements to an already sorted part of an array.
from easiest_sort import insertion_sort
my_list = []
insertion_sort(my_list)
Heap Sort
Use Case: Efficient for sorting large data sets. Utilizes the "heap" data structure. Possesses predictable worst-case performance.
from easiest_sort import heap_sort
my_list = []
heap_sort(my_list)
Shell Sort
Use Case: Balances implementation simplicity with good performance. Often applied in scenarios where a trade-off between efficiency and implementation simplicity is desired.
from easiest_sort import shell_sort
my_list = []
shell_sort(my_list)
Ascending and Descending order
If you want to use descending order sorting, you should use the second argument 'order' with a value of False. Its works with every sort algorithm
from easiest_sort import *
my_list = []
bubble_sort(my_array, order=False)
Partial Sort
This module provides a partial_sort function, allowing you to perform partial sorting on a list. With this function, you can sort only the top or bottom k elements of the list, leaving the rest of the elements in their original order.
Usage
from easiest_sort import partial_sort
my_array = [5, 2, 8, 1, 9, 4, 7, 3, 6]
x1 = partial_sort(my_array, 3, top=True)
x2 = partial_sort(my_array, 3, top=False)
Also you can use Reverse Order for Partial Sort
from easiest_sort import partial_sort
my_list = [5, 2, 8, 1, 9, 4, 7, 3, 6]
x = partial_sort(my_array, 3, top=True, reverse=True)
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
File details
Details for the file easiest_sort-0.0.2.tar.gz.
File metadata
- Download URL: easiest_sort-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
952fbf85dfc66bc980366d7dc0b5237ef0feccc8aba2513d8996a042fbef1653
|
|
| MD5 |
c29f0401a050189b557e7837e00f5fd9
|
|
| BLAKE2b-256 |
487dfed9caaa01783d0e93b61699148be4ed4f19a0df9929bf2b7f3761055069
|