Crates.io | sorting-race |
lib.rs | sorting-race |
version | 0.2.0 |
created_at | 2025-09-14 08:49:26.568548+00 |
updated_at | 2025-09-14 14:02:06.348969+00 |
description | Terminal-based sorting algorithm race visualization tool with real-time metrics |
homepage | https://github.com/avifenesh/algo-zoo |
repository | https://github.com/avifenesh/algo-zoo |
max_upload_size | |
id | 1838497 |
size | 1,037,089 |
Watch sorting algorithms race against each other in your terminal!
A beautiful terminal visualization that runs multiple sorting algorithms simultaneously, showing their real-time progress, comparisons, and memory usage.
Download for your platform from GitHub Releases:
Available Platforms:
sorting-race-linux-*.tar.gz
sorting-race-macos-*.tar.gz
sorting-race-windows-amd64.zip
# Linux/macOS - extract and run
tar -xzf sorting-race-*-*.tar.gz
./sorting-race
# Windows - extract and run
sorting-race.exe
Install from crates.io - requires Rust toolchain:
cargo install sorting-race
sorting-race
For development or latest unreleased features:
# Clone and build
git clone https://github.com/avifenesh/algo-zoo.git
cd algo-zoo
cargo build --release
# Run
./target/release/sorting-race
💡 Tip: Pre-built binaries are fastest to get started. Use Cargo install if you want automatic updates with
cargo install-update sorting-race
.
# Run with defaults (50 elements)
sorting-race
# Larger array
sorting-race --size 100
# Different data pattern
sorting-race --distribution reversed
# Custom fairness mode
sorting-race --fair weighted --alpha 2 --beta 0.5
Key | Action |
---|---|
Space |
Pause/Resume the race |
R |
Reset with new random data |
Q |
Quit application |
-s, --size <N>
- Number of elements to sort (default: 50)-S, --seed <SEED>
- Random seed for reproducible runs-d, --distribution <TYPE>
- Data distribution patternshuffled
- Random order (default)reversed
- Worst case for some algorithmsnearly-sorted
- Best case for adaptive algorithmsfew-unique
- Tests stability with duplicates--fair comp
)Each algorithm gets equal comparison operations per step.
sorting-race --fair comp --budget 16
--fair weighted
)Balance between comparisons (α) and moves (β).
sorting-race --fair weighted --alpha 2.0 --beta 0.5
--fair walltime
)Each algorithm gets equal CPU time slices.
sorting-race --fair walltime
--fair adaptive
)Dynamically adjusts based on algorithm progress.
sorting-race --fair adaptive --learning-rate 0.3
Algorithm | Best Case | Average | Worst Case | Memory |
---|---|---|---|---|
Bubble Sort | O(n) | O(n²) | O(n²) | O(1) |
Insertion Sort | O(n) | O(n²) | O(n²) | O(1) |
Selection Sort | O(n²) | O(n²) | O(n²) | O(1) |
Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) |
Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) |
Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) |
Shell Sort | O(n log n) | O(n^1.3) | O(n²) | O(1) |
sorting-race --size 100 --distribution nearly-sorted
Watch how Insertion Sort excels on nearly sorted data!
sorting-race --size 500 --fair adaptive --learning-rate 0.5
See how the system adapts to give slower algorithms more resources.
sorting-race --size 100 --distribution reversed --fair comp --budget 8
Observe how Quick Sort struggles with reversed data.
sorting-race --size 50 --distribution few-unique
Test which algorithms maintain the relative order of equal elements.
Contributions are welcome! Check out DEVELOPER.md for development setup and guidelines.
MIT License - see LICENSE for details.
Built with amazing Rust libraries:
Enjoy watching algorithms race! May the best sort win! 🏆