9 lines
241 B
Python
9 lines
241 B
Python
|
def bubbleSort(arr):
|
||
|
for i in range(1,len(arr)):
|
||
|
for j in range(0,len(arr)-i):
|
||
|
if arr[j] > arr[j + 1]:
|
||
|
arr[j], arr[j + 1] = arr[j + 1], arr[j]
|
||
|
return arr
|
||
|
nums = [1,3,2,4,6]
|
||
|
print(bubbleSort(nums))
|