Skip to content

majawalde/sorting-algorithms-visualizer

Repository files navigation

Sorting Algorithm Visualizer

Skjermopptak 2023-10-12 kl  00 06 59

Description

This project visualizes various sorting algorithms using a graphical user interface built with Java Swing. It allows users to observe the detailed working of several sorting algorithms through graphical bars, representing array elements, and provides insights into their complexity through on-screen text.

Features

  • Visualization of Sorting Algorithms: Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort, and Heap Sort.
  • Complexity Display: Dynamically shows the best, average, and worst-case complexities of selected algorithms.
  • Speed Control: A slider that allows control over the visualization speed.
  • Reset Functionality: Generates a new random array for fresh visualization.

Prerequisites

  • JDK 8 or later

How to Run

  1. Clone/Download the repository.
  2. Navigate to the project directory.
  3. Compile the Java files:

javac *.java

  1. Run the SortingFrame class:

java SortingFrame

Usage

  • Start Visualization: Click on the desired algorithm button to begin visualization.
  • Adjust Speed: Utilize the slider for controlling the visualization speed.
  • Reset: Click the "Reset" button to generate a new array and clear complexity information.
  • Algorithm Complexity: View the best, average, and worst-case time complexities on the screen when an algorithm is running.

Known Issues

  • Colors can be innaccurate for some algorithms

Future Enhancements

  • Implementation of additional sorting algorithms.
  • Enabling adjustment of the array size through GUI.

About

Common sorting algorithms visualized with Java Swing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages