tanishq2520/Algo-Visualizer

feat: Track and display comparison and swap counters

开放

#7 创建于 2025年10月12日

 (2 条评论) (0 个反应) (0 位负责人)Python (10 个派生)auto 404
good first issuehacktoberfest

仓库指标

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

描述

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:

贡献者指南