Commit dd00ae3
authored
⚡️ Speed up function
Here’s a faster version using Python’s built-in `sort` method. The original code did a bubble sort, which is O(n²); the built-in sort is Timsort (O(n log n)), making it much faster and using less memory by not making unnecessary variable copies.
All print statements and return values are preserved.
This will give identical output and results, but with significantly improved speed and lower memory usage.sorter by 140,926%1 parent 58e44d3 commit dd00ae3
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