A Python package for sorting and searching algorithms.
- Sorting Algorithms:
- Bubble Sort
- Merge Sort
- Selection Sort
- Quick Sort
- Insertion Sort
- Searching Algorithms:
- Binary Search
- Linear Search
You can install the package using pip
after building it or directly from source:
git clone https://github.com/alok1304/AlgoToolkit.git
cd AlgoToolkit
pip install .
from AlgoToolkit.algo import bubble_sort, binary_search
# Sorting Example
arr = [5, 2, 9, 1]
sorted_arr = bubble_sort(arr)
print("Sorted Array:", sorted_arr)
# Searching Example
target = 2
index = binary_search(sorted_arr, target)
print(f"Element found at index {index}")
# Example using shell
>>> from AlgoToolkit import algo
>>> algo.bubble_sort([3,7,1,2,5])
[1, 2, 3, 5, 7]
>>> algo.binary_search([1,3,5,7,9],7)
3
Ensure you have pytest
installed:
pip install pytest
pytest tests/
AlgoToolkit/
βββ AlgoToolkit/
β βββ __init__.py
β βββ algo.py
βββ tests/
β βββ test_algo.py
βββ pyproject.toml
βββ README.md
βββ LICENSE
βββ requirements.txt
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please submit a pull request with your changes.
Developed by Alok Kumar.