Commit b39eab8
authored
⚡️ Speed up function
Here’s an optimized version that replaces the O(n²) bubble sort with Python's highly-efficient built-in `sort()`, which runs in O(n log n) time and uses less memory by sorting in-place, while preserving all the comments and output.
This preserves the behavior and signature exactly while greatly improving performance.sorter by 173,949%1 parent 217adfa commit b39eab8
1 file changed
+2
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
| 4 | + | |
9 | 5 | | |
10 | 6 | | |
0 commit comments