This repository contains a Python implementation of the Quicksort algorithm with a live visualization using matplotlib. This project aims to demonstrate how Quicksort works by visually sorting an array of random integers, making the process easy to understand.
- Quicksort algorithm: A divide-and-conquer sorting algorithm that recursively sorts elements around a pivot.
- Visualization: The algorithm is visualized in real-time using
matplotlibbar charts, showing the changes in array order as it is sorted.
-
Clone the repository:
git clone https://github.com/yourusername/quicksort-visualization.git cd quicksort-visualization -
Install required libraries: You will need
matplotlibandnumpy. Install them with:pip install matplotlib numpy
To run the visualization:
python quicksort_visualization.pyThis will generate a random array of 20 integers and show the sorting process step by step.
- The array is split into three parts: elements less than the pivot, equal to the pivot, and greater than the pivot.
- The algorithm recursively sorts the left and right subarrays.
- As the sorting occurs, the
matplotlibbar chart is updated to reflect the current state of the array.
This project is licensed under the MIT License. See the LICENSE file for details.
