Bubble Sort
Add your data below:
Invalid user input
Try data with more numbers
Input Data
Sorted Data
Bubble Sort source code
Source Code:
def sort(arr: List[int]) -> List[int]:
sorted_index = len(arr) - 1
while sorted_index != 0:
for i in range(1, sorted_index + 1):
if arr[i - 1] > arr[i]:
arr[i], arr[i - 1] = arr[i - 1], arr[i]
sorted_index -= 1
return arr