Practice for implementing algorithms and data structures in Python.
- Worst-case time complexity:
O(n^2)
- Best-case time complexity:
O(n)
- Average-case time complexity:
O(n^2)
- Worst space complexity:
O(1)
- The same as bubble sort, but traverses the list in reverse order and moves the smallest element to the start of the list.
- Bidirectional bubble sort, that performs a bubble sort in both directions
- Performs better than bubble sort, but still has the same worst-case time complexity
- Worst-case time complexity:
O(n^2)
- Best-case time complexity:
O(n)
- Average-case time complexity:
O(n^2)
- Worst space complexity:
O(1)
- Worst-case time complexity:
O(n^2)
- Best-case time complexity:
O(n)
- Average-case time complexity:
O(n^2)
- Worst space complexity:
O(1)
- Worst-case time complexity:
O(n^2)
- Best-case time complexity:
O(n^2)
- Average-case time complexity:
O(n^2)
- Worst space complexity:
O(1)
- Worst-case time complexity:
O(nlogn)
- Best-case time complexity:
O(nlogn)
- Average-case time complexity:
O(nlogn)
- Worst space complexity:
O(n)
- Worst-case time complexity:
O(n^2)
- Best-case time complexity:
O(nlogn)
- Average-case time complexity:
O(nlogn)
- Worst space complexity:
O(logn)
- Clone the repository with
git clone https://github.com/LexGlu/algorithms-ds.git
- Navigate to the root directory of the project with
cd algorithms-ds
- Create a virtual environment with
python -m venv venv
- Activate the virtual environment with
source venv/bin/activate
- Install the dependencies with
pip install -r requirements.txt
Pytest is used for automated testing of each algorithm. To run the tests, run pytest
in the root directory of the project.