Tuesday, April 14, 2015

Sorting Algorithm Visualizer

This was FUN. I made a program that showcases four different sorting algorithms. You can choose four different array sizes (64, 128, 256 or 512 elements), and the algorithm to display. You can also choose the speed you want the algorithm to run at by clicking the bar along the bottom- farther left is slower. If possible, the element will turn green when the algorithm deems that element sorted. It will also highlight elements being compared in red.

Also, there's a difference between Quick Sort and Quick Sort 2- the second uses the median of the leftmost, center and rightmost elements as the pivot, whereas the first just uses the element on the far left. This means Quick Sort 2 is generally more efficient in its choice of pivot.
Download it here!
Also grab the source code here!
Bubble Sort with an array of 64 elements
Gnome Sort with 128 elements
Merge Sort with 256 elements
Quick Sort with 512 elements
 
The GUI!

1 comment: