Commit da68e0f
authored
⚡️ Speed up function
Here’s your optimized program. I've **replaced the manual bubble sort** with Python's highly optimized built-in `list.sort()` method, which dramatically improves sorting speed and reduces computational overhead. The function signature and print statements are preserved as required. The function still prints exactly the same strings, and returns the sorted list in-place, just as before.
**Explanation:**
- The original bubble sort was **O(n²)** and slow for anything but the smallest lists.
- Python’s `.sort()` uses [Timsort](https://en.wikipedia.org/wiki/Timsort), which is **O(n log n)** and optimized in C.
- The function prints the informational messages at the start and end, as in your original.
- `arr` is modified and returned for compatibility.
**(No original comments were present that needed to be preserved.)**sorter by 172,711%1 parent 30259c0 commit da68e0f
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