Skip to content

dlarocque/algorithm-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

algorithm-visualizer

An application for visualizing sorting algorithms.

This is my freshman year summer project! Trying to get a better understanding of sorting algorithms before my Data Structures and Algorithms class this fall while applying new things i've learned such as Swing, Git, Maven, and multi-threading.

Despite this type of project being unoriginal, the code itself is original.

AlgorithmVisualizer

Installation

Prerequisite

You must have the JDK installed on your system Download JDK

Have Apache Maven version 3.6.3 or later installed on your computer (If you want to modify source code)


Clone

git clone https://github.com/dlarocque/AlgorithmVisualizer

Download ZIP

Download the .zip file from https://github.com/dlarocque/AlgorithmVisualizer and extract its contents

Running

For Linux/macOS users

From the root of the project, build and execute simultaneously:

mvn install exec:java -Dexec.mainClass=com.example.algorithmvisualizer.Main

How to use

On startup, the application will open up a frame containing buttons and an unsorted array in bar form. There is a Reset button, a button for each sorting algorithm, a drop down size changer, an FPS slider, and a label showing statistics.

The Reset Button will re-shuffle the array and stop any sorting that is being done, while keeping the size set to the array.

The Sort Buttons will be available when sorting isn't being done. Clicking any of them will start sorting the displayed array with the selected sorting algorithm.

The Size Changer is initially set at N = 10, clicking it will open a drop down menu listing the available array sizes, clicking any of them will stop sorting and display a new array of the chosen size.

The FPS Slider is initialially set at 10 fps, it ranges from 1 fps all the way to 100 fps. This slider can be used to speed up the sorting / visualization process on bigger arrays or slow it down to get a better understanding of the sorting process on smaller arrays. It can be used before, during, and after sorting.

The Performance Label between the array and the buttons displays all of the stats that can help the user understand how different sorting algorithms perform compared to each other. (It's interesting to see how bubble sort is better performing than merge and quick sort on small arrays)

Notes

The time to visualize the sorting of one of the algorithms is not a good representation of its real sorting time. This is because the arr is updated every time there is an index swap, this makes it so that sorting algorithms with fewer swaps are visualized much faster. This is the reasoning behind including a 'Sorting Time' stat along with 'Visualzation Time' in the Performance label.

Authors

License

This project is licensed under the MIT License. See LICENSE.txt for more details

Issues

If there is an issue with the application, please take a look at issues. If your issue is not already listed, please create a new issue that describes your problem!

Acknowledgments

Inspiration for the project https://www.youtube.com/watch?v=kPRA0W1kECg

About

An application that visualizes sorting algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages