Which sorting algorithm repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order?
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares adjacent elements, and swaps them if they are in the wrong order. It is known for its simplicity but is less efficient than other sorting algorithms like Quick Sort and Merge Sort in terms of time complexity.
Loading...
Related Quiz
- The keyword ________ is used within a constructor to call another constructor in the same class.
- Which of the following primitive data types has the largest size in memory?
- What will be the output of the following code snippet: System.out.println(10 + 20 + "Hello" + 30 + 40);?
- Which operator can be used to invert the sign of a numeric expression?
- Can a constructor be private in Java?