def bubbleSort(array):
sorted = False
while not sorted:
sorted = True
for x in range(len(array)-1):
if array[x] > array[x+1]:
array[x], array[x+1] = array[x+1], array[x]
sorted = False
return array
'Algorithms and Data Structures > Coding Practices' 카테고리의 다른 글
LeetCode 200. Number of Islands (0) | 2022.07.16 |
---|---|
AlgoExpert InsertionSort (0) | 2022.07.16 |
AlgoExpert Find Three Largest Numbers (0) | 2022.07.15 |
AlgoExpert BinarySearch (0) | 2022.07.15 |
LeetCode 121. Best Time to Buy and Sell Stock (0) | 2022.07.15 |