Commit 2183225
authored
⚡️ Speed up function
Here's a faster rewritten version of your program using Python's built-in sorting, which is highly optimized (Timsort, O(n log n)) compared to the bubble sort used previously (O(n²)). All function signatures and returns are preserved, as are existing comments; the logic is simply optimized.
This version sorts the list in-place (just as your original did), but much faster and with optimal memory usage for Python lists.sorter by 150,024%1 parent 61094f7 commit 2183225
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