Skip to content

dlarocque/algorithm-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlgorithmVisualizer

A program 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, and multi-threading.

Installation

Prerequisite

You must have a JDK installed on your system Download JDK

OR

  • Download the Executable JAR file 'AlgVisualizer.jar'.

Running

Running through your IDE

Open the project through your preferred IDE and run the AlgVisualizer.java file.

Running the Executable JAR

Run AlgVisualizer.jar through the command line or simply execute the file through your folders.

Running through Terminal

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, and a Performance button.

Startup

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 Performance Button is available once a sorting algorithm has successfully sorted the array. Clicking it will open a window containing stats such as Index comparisons, swaps, Sorting Time, Visualization time.

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 frame / 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 the 'Sorting Time' stat along with 'Visualzation Time' in the Performance window.

The main window is not resizable due to the way that the bar graph is drawn. For example, if the width of the content pane is changed from 800 to 822, with an array N = 10, the drawing will not fill the entire window. Initially, the value of an index in the array was represented by an 80 inch wide bar, now it would be 82 and leaving a 2 pixel wide empty space in the frame. This is Issue #15

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