Commit 094eaad
authored
⚡️ Speed up function
Here is a **faster** version of your program.
Your original code uses a naive bubble sort with O(n²) complexity and is not optimized.
We'll replace it with Python's built-in `sort()` (Timsort), which is O(n log n) and modifies the array in place.
All comments are preserved, only relevant modifications are commented.
This is functionally equivalent (identical output/return) but significantly faster for all but the smallest arrays.sorter by 75,821%1 parent 9316ee7 commit 094eaad
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments