feat: Implement and Visualize Quick Sort with Partition Highlighting
#29 opened on Oct 13, 2025
Repository metrics
- Stars
- (0 stars)
- PR merge metrics
- (PR metrics pending)
Description
This is an advanced task for those looking for a real challenge. Unlike simple sorting algorithms, Quick Sort is recursive and involves a partitioning step that is fascinating to visualize. The main difficulty is clearly showing the pivot, the pointers, and the recursive calls on the sub-arrays.
Core Tasks: Implement Quick Sort Logic:
The core logic must be implemented as a Python generator function that yields the state at every critical step (comparisons and swaps).
Visualize the Partition Process:
The generator must yield not just the array, but also the indices of the pivot element, the left pointer, and the right pointer.
The Matplotlib plotting function must be updated to color these bars differently (e.g., Pivot = Yellow, Pointers = Red). This is the key to making the visualization understandable.
Visualize Recursion (Bonus Challenge):
To show which part of the array is currently being sorted, the generator could also yield the start and end indices of the current sub-array.
The plotting function can then "grey out" the bars that are not part of the current recursive call, bringing focus to the active partition.