This project contains implementations of various algorithms in Python. Each algorithm is implemented in a separate file for clarity and ease of use.
- File:
001_binary_search.py
- Description: This algorithm finds the position of a target value within a sorted array. It compares the target value to the middle element of the array.
- Time Complexity: O(log n)
- File:
002_selection_sort.py
- Description: This algorithm sorts an array by repeatedly finding the smallest element from the unsorted part and putting it at the beginning.
- Time Complexity: O(n^2)
- File:
003_recursive_sum.py
- Description: This algorithm calculates the sum of all elements in an array using recursion.
- Time Complexity: O(n)
- File:
003_recursive_sum.py
- Description: This algorithm counts the number of elements in an array using recursion.
- Time Complexity: O(n)
- File:
003_recursive_sum.py
- Description: This algorithm finds the maximum value in an array using recursion.
- Time Complexity: O(n)
- File:
004_quick_sort.py
- Description: This algorithm sorts an array by dividing it into smaller sub-arrays based on a pivot element and recursively sorting the sub-arrays.
- Time Complexity: O(n log n) on average
To run any of the algorithms, simply execute the corresponding Python file. For example, to run the selection sort algorithm:
python 002_selection_sort.py
- Python 3.x
This project is licensed under the MIT License.