[Algorithm] Bubble sort Bubble Sort At the i th iteration (0 0; i--) { for (int j = 0; j list[j + 1]) { // Swap if they are in the wrong order. SWAP(list[j], list[j + 1], temp); } } } } Time complexity Best case: O(n) Worst case: O(n²) Bubble sort is stable. Computer Science/Algorithm 2023.12.26