Bubble Sort Code Optimization

In the code of bubble sort discussed , shouldn’t we need to leave last block of array after each round as the largest second largest and so on are stored and they do not need be to swapped?

hi @himanshuanand729 yes u can do that but still the overall complexity will be o(n2)

1 Like