diff --git a/code_to_optimize/bubble_sort_3.py b/code_to_optimize/bubble_sort_3.py index db7db5f92..5e59e92cf 100644 --- a/code_to_optimize/bubble_sort_3.py +++ b/code_to_optimize/bubble_sort_3.py @@ -1,8 +1,4 @@ def sorter(arr): - for i in range(len(arr)): - for j in range(len(arr) - 1): - if arr[j] > arr[j + 1]: - temp = arr[j] - arr[j] = arr[j + 1] - arr[j + 1] = temp + # Use built-in sorted which is highly efficient for any input + arr.sort() return arr