Skip to content

A graphical C++ application that visualizes the Merge Sort algorithm using SFML. Features interactive controls, adjustable speed, and real-time statistics for educational and demonstration purposes.

License

Notifications You must be signed in to change notification settings

puranjay369/MergeSortVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Merge Sort Visualizer (SFML)

A graphical visualizer for the Merge Sort algorithm using C++ and SFML.

Features

  • Step-by-step animation of Merge Sort
  • Adjustable speed and array size
  • Statistics: comparisons, array accesses, merge operations
  • Interactive controls

Requirements

  • C++17 or newer
  • SFML 2.x (Simple and Fast Multimedia Library)
    • Libraries: sfml-graphics, sfml-window, sfml-system
  • Windows (tested), but should work on Linux/macOS with minor changes

Setup Instructions

  1. Install SFML
  2. Build the Project
    • Open a terminal in the final directory and run:
      g++ -std=c++17 merge_sort_visualizer.cpp -o merge_sort_visualizer.exe -lsfml-graphics -lsfml-window -lsfml-system
    • Or use the provided VS Code build task (build SFML).
  3. Run the Visualizer
    • In the final folder, run:
      ./merge_sort_visualizer.exe

Controls

  • SPACE: Play/Pause animation
  • R: Reset to beginning
  • UP/DOWN arrows: Adjust speed
  • N: Generate new random array (same size)
  • ESC: Exit program

Troubleshooting

  • If you see errors about missing DLLs, download them from the SFML website and place them next to the .exe.
  • If you get linker errors, make sure SFML is installed and the library paths are set up correctly.

License

This project is for educational purposes. See SFML's license for DLL redistribution terms.


Feel free to fork, modify, and share!

About

A graphical C++ application that visualizes the Merge Sort algorithm using SFML. Features interactive controls, adjustable speed, and real-time statistics for educational and demonstration purposes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages