tanishq2520/Algo-Visualizer

feat: Track and display comparison and swap counters

Aperta

#7 aperta il 12 ott 2025

 (2 commenti) (0 reazioni) (0 assegnatari)Python (10 fork)auto 404
good first issuehacktoberfest

Metriche repository

Star
 (0 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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:

Guida contributor