About 1,150,000 results
Open links in new tab
  1. Java Program for Bubble Sort - GeeksforGeeks

    Oct 22, 2024 · Bubble Sort in Java is not the best method to sort an array but is one of the most basic implementations for one to learn. In this article, we will learn how to write a program for Bubble Sort in Java.

  2. Appian Community

    Nov 24, 2022 · Bubble sort starts with very first two elements, comparing them to check which one is greater. ( 5 1 4 2 8 ) –> ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1.

  3. java - BubbleSort Implementation - Stack Overflow

    Jul 25, 2012 · Here is the code: public static void main(String[] args) . Random generator = new Random(); int[] list = new int[11]; for(int i=0; i<list.length; i++) list[i] = generator.nextInt(10); System.out.println("Original Random array: "); printArray(list); bubbleSort(list); System.out.println("\nAfter bubble sort: "); printArray(list);

  4. Bubble Sort In JavaJava Sorting Algorithms & Code Examples

    Apr 1, 2025 · This Tutorial will Explain the Bubble Sort in Java along with Major Sorting Algorithm in Java, Bubble Sort Algorithm, Implementation & Code Examples.

  5. Bubble Sort: Step-by-Step Explanation with Java Code | by

    Apr 3, 2025 · Here’s a Java program implementing Bubble Sort. static void bubble_sort(int[] arr, int n) { for (int i = n - 1; i >= 0; i--) { // Start from the last element. for (int j = 0; j <= i - 1;...

  6. Bubble Sort Java algorithm - Examples Java Code Geeks - 2025

    Jun 26, 2014 · In this article, we will talk about its function and its implementation in Java. The Bubble sort algorithm sometimes is referred as sinking sort, works as continuously iterating and swapping the items adjacent to each other in an array.

  7. Bubble Sort in Java - Javacodepoint

    Bubble Sort is a simple comparison-based sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items, and swapping them if they are in the wrong order. This process is repeated until the list is sorted. Start with the first element in the array. Assume the array has n elements.

  8. Bubble Sort in Java (With Intuition + Dry run + Code)

    Apr 3, 2024 · Bubble Sort gets its name from the way smaller elements "bubble" to the top of the list, much like air bubbles rising to the surface in water. In this sorting algorithm, adjacent elements are compared and swapped if they are in the wrong order.

  9. Bubble Sort in Java: A Detailed Analysis with Code Examples

    Jan 20, 2025 · In this comprehensive guide, we‘ll explore the intricacies of bubble sort in Java through code examples, visualizations, performance analysis, and comparisons to alternative options. How the Bubble Sort Algorithm Works. The logic behind bubble sort centers on comparing and swapping adjacent elements across multiple passes.

  10. Bubble Sort Algorithm in Java - Medium

    Sep 26, 2023 · Let’s learn the concept of bubble sort using Java code. If you want to sort items, elements or numbers in order, initially have to store them somewhere. For that, you can store them in an...

Refresh