Skip to main content

Bubble Sort

Learn Bubble Sort (Sorting, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Bubble Sort - O(n²) Repeatedly compares adjacent elements and swaps them if out of order, "bubbling" the largest unsorted element to the end each pass. Simple to understand, but inefficient for large inputs.

More lessons in Sorting