About 197,000 results
Open links in new tab
  1. Bubble sort on 2D Array Java - Stack Overflow

    Apr 25, 2014 · I understand the bubble sort when it comes to one dimensional arrays but 2D's are throwing me off. So if I understand your correction to my code, the second for loop specifically focuses on comparing the first column values?

  2. Bubble Sort for 2D Array in Java - EnableGeek

    Bubble sort for a 2D array in Java works by iterating over each row of the array and applying the bubble sort algorithm to each row separately. This means that we sort the first row, then the second row, and so on until we have sorted all rows in the 2D array.

  3. Java Program for Bubble Sort - GeeksforGeeks

    Oct 22, 2024 · Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. 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.

  4. Sorting a 2D Array according to values in any given column in Java

    Oct 22, 2024 · Our task is to sort the 2D array according to values in Column K. Examples: Sorting it by values in column 3. Output: Java Program to Sort a 2D Array according to values in any given Column. Java Program to sort 2D Matrix according to any Column. The idea is to use Arrays.sort in Java. Syntax: Example: Explanation of the above Program:

  5. 2d array ascending bubblesort java - Stack Overflow

    Sep 9, 2014 · I am trying to implement bubble sort on a 2D array to put the rows in ascending order, but it is only moving the first item. How can I fix this?

  6. A Comprenhensive Guide on Bubble Sort For 2D Array in Java

    Jul 4, 2023 · This code snippet demonstrates the implementation of the bubble sort algorithm for sorting a 2D array in Java. The bubbleSort method takes a 2D array as input and sorts each row of the array in ascending order using the bubble sort algorithm.

  7. java - Bubble-Sort with 2D Array - Stack Overflow

    Dec 6, 2009 · you can have an ordinary array of Person objects, sorting them with your bubble sort algorithm. You can create several custom comparators that compare either id, name, surname or address to you bubble sort algo. The signature of the sort method should be something like. public Person[] bubbleSort(Person[] persons, Comparator comp)

  8. Row wise sorting a 2D array - GeeksforGeeks

    Apr 3, 2025 · Given a 2D array, sort each row of this array and print the result. Examples: The idea is simple, we traverse through each row and call sort for it. Below are sort functions for reference in different languages. [3, 11, 22, 77] [1, 11, 12, 89] [7, 11, 32, 56] [11, 22, 33, 44]

  9. Bubble Sort in Java - Baeldung

    Jan 8, 2024 · In this quick article, we’ll explore the Bubble Sort algorithm in detail, focusing on a Java implementation. This is one of the most straightforward sorting algorithms; the core idea is to keep swapping adjacent elements of an array if they …

  10. Java bubble sort algorithm example - W3schools

    Bubble sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

Refresh