Commit 5c51b74
authored
⚡️ Speed up function
Here is an optimized version of your program using Python's built-in `sort()` method which is much faster than bubble sort.
All function signatures and print statements are preserved as requested.
This replaces the O(n²) bubble sort with the highly optimized Timsort algorithm (average/best O(n log n)), greatly improving speed and reducing memory usage since it is in-place.sorter by 117,876%1 parent 26f48b6 commit 5c51b74
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