Metadata-Version: 2.1
Name: searchsort
Version: 0.1.5
Summary: Almost all Searching and Sorting Algorithms for Python 3.x
Home-page: UNKNOWN
Author: Programmin-in-Python (MK)
Author-email: <kalanithi6014@gmail.com>
License: UNKNOWN
Project-URL: GitHub, https://github.com/Programmin-in-Python/searchsort
Keywords: python3,sort,search,sorting,searching,sorting-algorithms,searching-algorithms,search-sort,searchsort
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown

# searchsort
A Python Package that contains almost all the Searching and Sorting Algorithms

It is also available in [GitHub](https://github.com/Programmin-in-Python/searchsort)

## Installation
**If there are 2 or more versions of Python installed in your system (which mostly occurs in UNIX/Linux systems) then please run any one of the commands in the BASH Shell \:-**
```bash
$ pip3 install searchsort
```
```bash
$ python3 -m pip install searchsort
```

**If there is only Python 3.x installed in your system like in Windows systems then please run any one of commands in the Command Prompt \:-**
```console
pip install searchsort
```
```console
python -m pip install searchsort
```
## Quick Guide
***Please Read till the End***
- Import the Package using `import searchsort as ss`.
- `ss.AvailableSearchingAlgorithms()` will show you the available Searching algorithms.
- `ss.AvailableSortingAlgorithms()` will show you the available Sorting algorithms.
- All the Functions have their **Asymptotic Analysis** in their docstrings. If you wish; you may take a note of it.

## A Searching Implementation
```python3
from random import shuffle
import searchsort as ss

L1 = [i for i in range(1, 51)]
element = 20

# Shuffling the List
shuffle(L1)

index = ss.LinearSearch(L1, element)

if index:
  print(f"{element} found at :", index)
else:
  print(f"{element} not found")
```
**Note \:-**
- **Some of the Algorithms require a sorted array. It is mentioned in the docstring of the functions so please read them carefully.**
- **All the Algorithms return the index of the First Occurrence of the element.**
- **If Element is Not Present, False is Returned.**

## A Sorting Implementation
```python3
from random import shuffle
import searchsort as ss

L1 = [i for i in range(1, 51)]

# Shuffling the List
shuffle(L1)
print("List Before Sorting :", L1)

Result = ss.BubbleSort(L1)
print("List After Sorting :", Result)
```
**Note \:-**
- **Some of the Algorithms perform an in-place sorting, which means the structure of the Original List will be changed.**
- **All the Algorithms return the sorted array, so assigning statements are preferred.**

## \'IsSorted\' Function Implementation
**Besides Searching an Element in an Array and Sorting Arrays, the Package also contains an 'IsSorted' Function that Returns True if an Array is _SORTED_ in either direction; False If NOT.**
```python3
from random import shuffle
from searchsort import IsSorted

L1 = [i for i in range(1, 51)]
print("Is the List Sorted Now? ", IsSorted(L1))

# Shuffling the List
shuffle(L1)

print("Is the List Sorted Now? ", IsSorted(L1))
```


