File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 1+ from code_to_optimize .bubble_sort_dep1_helper import dep1_comparer
2+ from code_to_optimize .bubble_sort_dep2_swap import dep2_swap
13
24
35def sorter_deps (arr ):
4- n = len (arr )
5- for i in range (n ):
6- # Introduce a flag that will allow us to exit early if no swaps occur
7- swapped = False
8- # Only iterate to the unsorted portion of the list
9- for j in range (n - 1 - i ):
10- # Inline the comparison function
11- if arr [j ] > arr [j + 1 ]:
12- # Inline the swap
13- arr [j ], arr [j + 1 ] = arr [j + 1 ], arr [j ]
14- swapped = True
15- # If no swaps occurred in the last inner loop, the array is sorted
16- if not swapped :
17- break
18- return arr
6+ for i in range (len (arr )):
7+ for j in range (len (arr ) - 1 ):
8+ if dep1_comparer (arr , j ):
9+ dep2_swap (arr , j )
10+ return arr
Original file line number Diff line number Diff line change 33from pathlib import Path
44
55import line_profiler
6-
76from codeflash .models .models import TestFile , TestFiles
87from codeflash .verification .parse_test_output import parse_test_xml
98from codeflash .verification .test_results import TestType
You can’t perform that action at this time.
0 commit comments