Skip to content

About

A Java program that implements the Bubble Sort algorithm to sort an array of integers. This project demonstrates basic sorting logic, iteration, and array manipulation in Java.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

BubbleSort

Description

This Java project implements the Bubble Sort algorithm, one of the simplest sorting techniques. The program sorts an array of integers by repeatedly stepping through the list, comparing adjacent elements, and swapping them if they are in the wrong order. The sorting process continues until the array is completely sorted.

Author

Written by Mohammed Qutu on 03/03/2024.

Requirements

  • Java 21.0.2 or later

Usage

To run the program, compile the BubbleSort.java file and execute it. The program will print the sorted array to the console after performing the sorting operation.

Example Output

2 3 5 8 9

How the Bubble Sort Works:

  1. Compare each pair of adjacent elements.
  2. If the first element is greater than the second, swap them.
  3. Continue through the array until no more swaps are needed.
  4. The array is now sorted.

Code Structure:

  • The while loop continues until no more swaps are needed.
  • The for loop iterates through the array and compares adjacent elements.
  • The swap variable is used to keep track of whether any swaps have been made during the iteration.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Java program that implements the Bubble Sort algorithm to sort an array of integers. This project demonstrates basic sorting logic, iteration, and array manipulation in Java.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages