MCPcopy Create free account
hub / github.com/geekcomputers/Python / bubblesort

Function bubblesort

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

Source from the content-addressed store, hash-verified

1def bubblesort(list):
2 # Swap the elements to arrange in order
3 for iter_num in range(len(list) - 1, 0, -1):
4 for idx in range(iter_num):
5 if list[idx] > list[idx + 1]:
6 temp = list[idx]
7 list[idx] = list[idx + 1]
8 list[idx + 1] = temp
9
10
11list = [19, 2, 31, 45, 6, 11, 121, 27]

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected