156
92
116
334
80
232
24
376
84
74
190
234
344
278
88
256
312
130
88
168

Bubble Sort Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.The pass through the list is repeated until the list is sorted. The algorithm, which is a comparison sort, is named for the way smaller or larger elements "bubble" to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems
Complexity
  • Worst-case time complexity : O(n2)
  • Average time complexity : O(n2)
  • Best-case time complexity : O(n)
  • Worst-case space complexity : O(1)