Quick Start
Follow these steps to build and run the Sorting Algorithms Visualiser on your system. You’ll be visualizing sorting algorithms in just a few minutes!Prerequisites
Before you begin, make sure you have the following installed:- Windows Operating System (the application is built for Windows)
- C++ Compiler: Visual Studio 2019/2022 or compatible C++ compiler with C++20 support
- vcpkg: Microsoft’s C++ package manager for dependency management
- Git: For cloning the repository
This project uses SFML 2.6.2 for graphics rendering. The dependency is managed automatically through vcpkg.
Installation Steps
Clone the Repository
Open your terminal and clone the Sorting Algorithms Visualiser repository:This creates a local copy of the project on your machine.
Install Dependencies with vcpkg
The project requires SFML (Simple and Fast Multimedia Library). Install it using vcpkg:This command installs SFML version 2.6.2 as specified in
vcpkg.json.If you haven’t set up vcpkg integration with Visual Studio, run:This allows Visual Studio to automatically find vcpkg packages.
Build the Project
Using Visual Studio
- Open the solution file (
SortingAlgos.sln) in Visual Studio - Set the build configuration to Release or Debug (x64)
- Build the solution: Build > Build Solution (or press
Ctrl+Shift+B) - The executable will be generated in the output directory
Using Command Line (MSVC)
If you prefer command-line compilation:Make sure the
assets/ folder (containing Roboto-Regular.ttf) is in the same directory as the executable.Run the Application
Launch the visualizer by running the executable:A window titled “Sorting visualiser - DevBoiAgru” will open, displaying 250 vertical bars representing numbers from 1 to 250.
Try Your First Sort
Now let’s visualize a sorting algorithm:
- Click the “Shuffle” button (blue, top-left) to randomize the bars
- Click the “Bubble sort” button (cyan, second row) to start the algorithm
- Watch as the bars are compared and swapped:
- Red and green highlights show elements being compared
- Blue highlight appears during the final verification pass
- The algorithm completes when all bars are sorted from shortest to tallest
Try clicking “Reverse” to reverse the sorted list, then test a different algorithm like “Quick sort” to compare speeds!
Command-Line Usage
You can control the visualization speed by passing a delay parameter when launching the application:<delay>: Time delay between sorting operations in nanoseconds (default: 1ns)
Examples
Help Command
To see usage information:Understanding the Interface
When the application launches, you’ll see:- Top row buttons: Shuffle, Reverse, list size controls (+/-), Refresh, and Quit
- Second row buttons: Six sorting algorithm buttons (Selection, Bubble, Insertion, Quick, Bogo, Stalin)
- Center display: Current list size (e.g., “250”)
- Visualization area: Vertical bars representing the numbers to be sorted
The application window is 1080×720 pixels. Bars are positioned with a 50-pixel offset from the edges.
Troubleshooting
Missing SFML DLLs
Missing SFML DLLs
If you get an error about missing DLL files:
- Copy SFML DLLs from
vcpkg\installed\x64-windows\bin\to the same folder asSortingAlgos.exe - Required DLLs:
sfml-graphics-2.dll,sfml-window-2.dll,sfml-system-2.dll
Font Not Found Error
Font Not Found Error
The application requires Ensure this structure is maintained when running the executable.
Roboto-Regular.ttf in the assets/ folder:Build Errors with vcpkg
Build Errors with vcpkg
If Visual Studio can’t find SFML headers:
- Verify vcpkg integration:
vcpkg integrate install - Check that SFML is installed:
vcpkg list - Ensure you’re building for the correct platform (x64)
Invalid Delay Input
Invalid Delay Input
If you see “Invalid delay input” error:
- The delay parameter must be a positive integer (no decimals, signs, or letters)
- Valid:
SortingAlgos.exe 100000 - Invalid:
SortingAlgos.exe -50,SortingAlgos.exe 1.5,SortingAlgos.exe slow
What’s Next?
Now that you have the visualizer running, explore these topics:User Interface Guide
Learn about all the buttons and interactive controls
Algorithm Deep Dives
Understand how each sorting algorithm works under the hood
Build from Source
Explore the build process and compilation details
Contributing
Learn how to contribute improvements to the project