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
Here’s an optimized version of your program. Your original code uses a nested loop for bubble sort, which is O(n²). Python’s built-in `sort()` function (Timsort, O(n log n)) is much faster and more memory-efficient since it sorts in place.
All comments are preserved, and functionality is identical, but the run time will be much faster for all but minuscule lists.
0 commit comments