MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / bubblesort

Function bubblesort

Python/all sorting methods.py:2–7  ·  view source on GitHub ↗
(customList)

Source from the content-addressed store, hash-verified

1# BUBBLE SORT
2def bubblesort(customList):
3 for i in range(len(customList)-1): #O(n)
4 for j in range(len(customList)-i-1): #O(n)
5 if customList[j]>customList[j+1]: #O(1)
6 customList[j],customList[j+1]=customList[j+1],customList[j]
7 print(customList)
8# cList=[2,1,3,6,9,7,4,8,5]
9# bubblesort(cList)
10

Callers

nothing calls this directly

Calls 1

printFunction · 0.50

Tested by

no test coverage detected