tanishq2520/Algo-Visualizer

feat: Implement and Visualize Quick Sort with Partition Highlighting

开放

#29 创建于 2025年10月13日

 (3 条评论) (0 个反应) (1 位负责人)Python (10 个派生)auto 404
enhancementhacktoberfesthelp wanted

仓库指标

星标
 (0 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南