tanishq2520/Algo-Visualizer

feat: Track and display comparison and swap counters

Open

#7 opened on Oct 12, 2025

 (2 comments) (0 reactions) (0 assignees)Python (10 forks)auto 404
good first issuehacktoberfest

Repository metrics

Stars
 (0 stars)
PR merge metrics
 (PR metrics pending)

Description

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:

Contributor guide