Algorithm Visualiser is a terminal-based application that allows you to visualise sorting algorithms in real-time.
Currently, it supports the following algorithms:
- Bubble Sort.
- Selection Sort.
- Real-time visualisation of sorting algorithms.
- Interactive controls for starting, pausing, and stepping through the sorting process.
- Colour-coded elements to highlight current comparisons.
- Prerequisites: Ensure you have Go installed on your system.
- Getting the Program:
- Clone the repository or download the source code.
- Alternatively, you can directly install the program using Go:
This command installs the program into
go install
$GOPATH/bin
. After installation, you can run the program usingalgorithm-visualiser
command in your terminal.
- Running the Program:
- Directly execute the binary after building:
./algorithm-visualiser
- Or, if installed via
go install
, simply run:algorithm-visualiser
- Directly execute the binary after building:
- Keybindings (These are also displayed in the program):
s
: Start sorting.p
: Pause/Resume sorting.r
: Reset the array and sorting process.space
: Step through the algorithm (when paused).1
: Switch to Bubble Sort (default).2
: Switch to Selection Sort.q
,esc
, orctrl-c
: Quit the program.
- To compile the program:
go build
This command generates an executable in the current directory.
- You can also build and run in one step:
go build && ./algorithm-visualiser
- tcell Library: This project leverages the tcell library for managing terminal graphics and events.
- cli Package: Command-line interactions are powered by the cli package.