Skip to content

Step by step visual representation of the Bubble Sort algorithm using Java.

License

Notifications You must be signed in to change notification settings

amritBskt/Bubble-Sort-Visualization-GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bubble Sort Visualization

This project provides a visual representation of the Bubble Sort algorithm using Java. It helps users understand how Bubble Sort works by showing the sorting process step-by-step.

Features

  • Visual representation of the Bubble Sort algorithm
  • Step-by-step sorting process
  • Options to sort in ascending or descending order
  • User-friendly interface with control buttons to navigate through sorting steps

Getting Started

Prerequisites

  • Java Development Kit (JDK) 8 or later
  • An IDE or text editor of your choice

Installation

  1. Clone the repository to your local machine:
    git clone https://github.com/amritBskt/Bubble-Sort-Visualization.git
  2. Navigate to the project directory:
    cd Bubble-Sort-Visualization
  3. Open the project in your IDE or text editor.

Running the Application

  1. Compile the Java file:
    javac BubbleSortVisualization.java
  2. Run the application:
    java BubbleSortVisualization

Usage

  1. Launch the application.
  2. Enter the size of the array and the array values in the respective fields. Alternatively, you can directly enter the array values separated by commas.
  3. Select the order of sorting (ascending or descending).
  4. Click the "Run" button to start the sorting visualization.
  5. Use the left (◀) and right (▶) buttons to navigate through the sorting steps.
  6. Click the "Reset" button to reset the application and start over.

Code Overview

The main components of the project include:

  • BubbleSortVisualization.java: The main class that creates the GUI and handles the sorting logic.
    • GUI Components: Text fields, buttons, and panels for input, control, and visualization.
    • Event Handling: Implements ActionListener to handle button clicks.
    • Sorting Logic: Implements Bubble Sort with intermediate steps stored for visualization.
    • Visualization: Updates the GUI to show each step of the sorting process, including comparisons and swaps.

Contact

About

Step by step visual representation of the Bubble Sort algorithm using Java.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages