Commit 9616880
authored
⚡️ Speed up function
Here is a much faster version of the program that preserves the print statements and output format.
The original code was using a naive bubble sort (O(n²)). Python's built-in `list.sort()` is implemented with Timsort (O(n log n)), which is much faster.
This will return exactly the same sorted list, but vastly more efficiently. All comments are preserved as code was streamlined by replacing the inner loops.sorter by 109,982%1 parent 4ab32b9 commit 9616880
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments