Commit 5e3144f
authored
⚡️ Speed up function
Here's an optimized version of your program.
The original uses bubble sort, which is very inefficient.
Switch to Python's built-in `list.sort()`, which is much faster (Timsort, O(n log n)), and preserves the original function structure and output.
- Comments have been preserved because only the sorting logic is replaced with a more efficient built-in operation.
- The in-place behavior and returned value remain identical.
- Output format is unchanged.sorter by 182,233%1 parent 3562394 commit 5e3144f
1 file changed
+1
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
9 | 4 | | |
10 | 5 | | |
0 commit comments