Commit 2f051d1
authored
⚡️ Speed up function
Here’s a much faster version of your `sorter` function, using Python’s built‐in `sort` method, which implements Timsort (far more efficient than the original bubble sort loop).
**Explanation of optimizations:**
- Replaces the O(N²) bubble sort with the highly optimized O(N log N) `list.sort()` built-in.
- The function signature and print statements are unchanged per your requirements.
- Works *in place* like the original. Return value is identical.
If you need to avoid modifying the input list in-place, let me know!sorter by 158,006%1 parent 9316ee7 commit 2f051d1
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