Built with the power of Java Swing, Sorting Simulator is a visualizer and simulator for different sorting algorithms. It allows you to see different sorting algorithms in action, and observe their changes to arrays in real-time. Users can observe Bubble Sort, Selection Sort, Insertion Sort, Quick Sort, Merge Sort, Heap Sort, Intro Sort, Bozo Sort (my favorite), and even custom user sorting algorithms! Sorting Simulator can also compare the efficiency of different sorting algorithms by running multiple simulations of the same algorithm and giving you relevant statistics such as the time it took to sort, the number of comparisons, number of insertions, etc. Feel free to play around with the program!
To get started using this program, you will need to clone the repository. Then, simply run the Main.java file in the src folder and everything should be running.
When you start running the program, you will see a menu with the title "Sorting Algorithm Simulator", with a bunch of options. Here's a description of the options:
Option | Description |
---|---|
Sorting Algorithm | Choose from the dropdown menu of the sorting algorithms to be simulated |
Enter Size | Enter the size of the array to be sorted |
Enter Number of Simulations | Enter the number of simulations to perform. If this is >1, then displaying simulations is skipped unless "Show Every Simulation" is checked |
Use Custom Data | If checked, uses the custom dataset from data.txt as the array to be sorted |
Wait For Click To Continue | If checked, simulation only runs when user inputs the [ENTER] key in terminal |
Show Every Simulation | If checked, every simulation from "Enter Number of Simulations" is displayed |
Sound | If checked, sound is enabled |
Start Simulation | If clicked, starts the simulation with the given options |
Exit | If clicked, exits the program |
After Start Simulation is clicked and the simulation ends, you will see a menu that displays the average number of comparisons, swaps, insertions, and the amount of time taken for the given sorting algorithm. You will also see a "New Simulation" button, which, when pressed, will bring you back to the Main Menu to begin another simulation.
Note, while the simulation is sorting, it cannot be stopped. To stop the program while its sorting, use Ctrl + C in the terminal.
Project started in Bitcamp 2023 Hackathon by UMD Students Minsi Hu, Alison Wang, and Jonathan Mei! Minsi focused on implementing the sorting algorithms, Alison focused on creating the UI, and Jonathan focused on the graph rendering. Go team!