Commit 33c0c38
authored
⚡️ Speed up function
Here is your optimized program. The original code is a basic bubble sort with unnecessary repeated passes over the entire array and manual swapping. We can significantly improve the performance by replacing it with Python’s highly optimized built-in `sort()` method, which runs much faster and uses less memory for large arrays. The function signature and prints are preserved.
- All comments are preserved.
- The output remains identical.
- The sorting is now much faster, especially for larger arrays, and memory usage is minimized due to in-place sorting.sorter by 138,252%1 parent b92bf14 commit 33c0c38
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