MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / bubble_sort

Function bubble_sort

Sorting Algorithms/bubble_sort.py:1–8  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

1def bubble_sort(array):
2 for i in range(len(array)-1, 0, -1):
3 for j in range(i):
4 if array[j] > array[j+1]:
5 temp = array[j]
6 array[j] = array[j+1]
7 array[j+1] = temp
8 return array
9
10
11def bubble_sort_optimized(array):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected