You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Certainly! The current implementation uses bubble sort, which has a time complexity of \(O(n^2)\). We can achieve a much faster sorting by utilizing Python's built-in `sort()` method, which uses Timsort with a time complexity of \(O(n \log n)\).
Here's the optimized code.
This change significantly reduces the runtime for large lists while preserving the original functionality.
0 commit comments