Crate sorting_visualization[−][src]
sorting-visualization
A Rust program for visualizing sorting algorithms which uses Piston for graphics. Inspired by Hopson97/Sort-Algorithm-Visualiser.
Setup
git clone https://github.com/dmitmel/sorting-visualization
cd sorting-visualization
cargo build --release
Usage
# see 'Features' section for the list of supported algorithms and their IDs
# and use the --help flag to print all available animation options
cargo run <algorithm>
# list all available algorithms
cargo run -- --list
Features
- CLI
- Supports different algorithms (IDs are in brackets):
- Bubble sort [
bubble
] - Cocktail sort [
cocktail
] - Cycle sort [
cycle
] - Gnome sort [
gnome
] - Heap sort [
heap
] - Insertion sort [
insertion
] - Merge sort [
merge
] - Quicksort [
quicksort
] - Selection sort [
selection
] - Shellsort [
shellsort
]
- Bubble sort [
- Animation controls:
- Space - pause/resume
- ↑ - 2x faster
- ↓ - 2x slower
- Easy-to-use algorithm API
- Algorithms can highlight important array elements
- Code is well-documented
Building docs
./docs.sh
Nightly Rust is required for building docs because it has infra doc link resolution which is currently unstable.
TODO
- User-friendly GUI
- More algorithms
- Sound?
Contributing
PRs are appreciated!
License
Modules
algorithms | Different sorting algorithms as well as the general
|
app | The |
array | The |
cli | Command-line interface and command-line argument parsing. Uses clap under the hood. |
state | Structs and type definitions that describe the app state. |
Constants
OPENGL_VERSION | Required version of OpenGL. |
WINDOW_SIZE | Initial size of the main window. |
WINDOW_TITLE | Title of the main window. |
Functions
main | |
run |