This repository contains implementations of different variations of the Quicksort algorithm in Python. The variations include:
- Standard Quicksort
- Median of Three Quicksort
- Multi-Pivot Quicksort
The standard Quicksort algorithm is implemented in the quick_sort.py file. It uses the last element as the pivot and partitions the array around the pivot.
The Median of Three Quicksort algorithm is implemented in the median_of_three_quick_sort.py file. It uses the median of the first, middle, and last elements as the pivot.
The Multi-Pivot Quicksort algorithm is implemented in the multi_pivot_quick_sort.py file. It uses three pivots and partitions the array around these pivots.
To use these implementations, simply import the required function from the respective file and call it with the array to be sorted and the start and end indices as arguments. For example:
from quick_sort import quick_sort
arr = [3, 7, 8, 5, 2, 1, 9, 5, 4]
quick_sort(arr, 0, len(arr) - 1)
print(arr) # Output: [1, 2, 3, 4, 5, 5, 7, 8, 9]