+ 2
BUBBLE SORT: How can you stop the bubble sort when the list is already sorted?
sometimes unnecessary iterations take place because the list is already sorted https://code.sololearn.com/cgJ9ARRhG5hZ/?ref=app
1 Answer
0
you can add a function checking if the list is sorted before sorting it, but in most cases it will be unsorted, so more work will be done and it's useless
so no sensible way