tanishq2520/Algo-Visualizer
feat: Track and display comparison and swap counters
オープン
#7 opened on 2025/10/12
good first issuehacktoberfest
Repository metrics
- Stars
- (0 個のスター)
- PR merge metrics
- (PR metrics pending)
説明
To add an analytical layer, the visualizer should track key performance metrics for each algorithm run. This helps users understand the "cost" of an algorithm beyond just seeing it run.
Task:
In each sorting algorithm's logic, initialize two counters: comparisons = 0 and swaps = 0.
Increment the comparisons counter every time two elements are compared.
Increment the swaps counter every time two elements are swapped.
After the sorting animation is complete, display the final counts in the sidebar.
Use st.metric to display the results in a clean, visually appealing way. For example: