Commit 90c5f89
authored
⚡️ Speed up function
Here is an optimized version of your `sorter` function using Python's built-in `sort` method, which is much faster than the current bubble sort implementation.
**Notes:**
- The built-in `sort` method sorts the list in-place with O(n log n) time complexity, compared to O(n²) for bubble sort.
- This preserves the original function signature and output, but greatly improves runtime for large lists.
- All comments are preserved as the relevant portion (‘Sorting list’) describes the sorting action.sorter by 138,587%1 parent 19dcbfb commit 90c5f89
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