# 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.
```python
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
```python
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.
```python
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.
```python
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.
```python
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.
```python
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
```python
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
```python
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
```python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/eliastikus/Python",
"name": "easiest-sort",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "easiest sort",
"author": "Eliastikus",
"author_email": "eliastikus@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/48/7d/fed9caaa01783d0e93b61699148be4ed4f19a0df9929bf2b7f3761055069/easiest_sort-0.0.2.tar.gz",
"platform": null,
"description": "# Sorting Module in Python\r\n\r\nThis Python module provides implementations of several sorting algorithms. The current version includes the following sorting algorithms:\r\n\r\n- Bubble Sort\r\n- Merge Sort\r\n- Quick Sort\r\n- Insertion Sort\r\n- Heap Sort\r\n- Shell Sort\r\n- Partial Sort\r\n\r\n# How to install and import module \r\n\r\nTo install the module, you need to write in the terminal.\r\n\r\n```\r\npip install easiest_sort\r\n```\r\n\r\nTo import the module, you need to write in your Python file\r\n\r\n```\r\nfrom easiest_sort import *\r\n```\r\n\r\n\r\n## Bubble Sort\r\n\r\nUse Case: Simplicity and ease of understanding. Suitable for small data sets or educational purposes. Inefficient for large data sets due to quadratic complexity.\r\n\r\n```python\r\nfrom easiest_sort import bubble_sort\r\n\r\nmy_list = []\r\nbubble_sort(my_list)\r\n```\r\n\r\n## Merge Sort\r\n\r\nUse Case: Efficient sorting for large data sets. Relatively stable and well-suited for lists that do not fit entirely in memory\r\n\r\n```python\r\nfrom easiest_sort import merge_sort\r\n\r\nmy_list = []\r\nmerge_sort(my_list)\r\n```\r\n\r\n## Quick Sort\r\n\r\nUse Case: High efficiency on average and large data sets. Demonstrates good practical performance. Used in various domains, including programming languages and databases.\r\n\r\n```python\r\nfrom easiest_sort import quick_sort\r\n\r\nmy_list = []\r\nquick_sort(my_list)\r\n```\r\n## Insertion Sort\r\n\r\nUse Case: Effective for small or partially ordered data. Convenient when adding new elements to an already sorted part of an array.\r\n\r\n```python\r\nfrom easiest_sort import insertion_sort\r\n\r\nmy_list = []\r\ninsertion_sort(my_list)\r\n```\r\n\r\n## Heap Sort\r\n\r\nUse Case: Efficient for sorting large data sets. Utilizes the \"heap\" data structure. Possesses predictable worst-case performance.\r\n\r\n```python\r\nfrom easiest_sort import heap_sort\r\n\r\nmy_list = []\r\nheap_sort(my_list)\r\n```\r\n\r\n## Shell Sort\r\n\r\nUse Case: Balances implementation simplicity with good performance. Often applied in scenarios where a trade-off between efficiency and implementation simplicity is desired.\r\n\r\n```python\r\nfrom easiest_sort import shell_sort\r\n\r\nmy_list = []\r\nshell_sort(my_list)\r\n```\r\n\r\n\r\n## Ascending and Descending order\r\n\r\nIf 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\r\n\r\n\r\n```python\r\nfrom easiest_sort import *\r\n\r\nmy_list = []\r\nbubble_sort(my_array, order=False)\r\n```\r\n\r\n\r\n\r\n# Partial Sort \r\n\r\nThis 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.\r\n\r\n## Usage\r\n\r\n```python\r\nfrom easiest_sort import partial_sort\r\n\r\nmy_array = [5, 2, 8, 1, 9, 4, 7, 3, 6]\r\n\r\nx1 = partial_sort(my_array, 3, top=True)\r\n\r\nx2 = partial_sort(my_array, 3, top=False)\r\n```\r\n\r\nAlso you can use Reverse Order for Partial Sort\r\n\r\n```python\r\nfrom easiest_sort import partial_sort\r\n\r\nmy_list = [5, 2, 8, 1, 9, 4, 7, 3, 6]\r\n\r\nx = partial_sort(my_array, 3, top=True, reverse=True)\r\n```\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Python module for easiest and fast sort",
"version": "0.0.2",
"project_urls": {
"GitHub": "https://github.com/eliastikus",
"Homepage": "https://github.com/eliastikus/Python"
},
"split_keywords": [
"easiest",
"sort"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "487dfed9caaa01783d0e93b61699148be4ed4f19a0df9929bf2b7f3761055069",
"md5": "c29f0401a050189b557e7837e00f5fd9",
"sha256": "952fbf85dfc66bc980366d7dc0b5237ef0feccc8aba2513d8996a042fbef1653"
},
"downloads": -1,
"filename": "easiest_sort-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c29f0401a050189b557e7837e00f5fd9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3471,
"upload_time": "2024-01-06T16:52:42",
"upload_time_iso_8601": "2024-01-06T16:52:42.143984Z",
"url": "https://files.pythonhosted.org/packages/48/7d/fed9caaa01783d0e93b61699148be4ed4f19a0df9929bf2b7f3761055069/easiest_sort-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-06 16:52:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eliastikus",
"github_project": "Python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "easiest-sort"
}