Skip to content

Conversation

@Shubham-chaudhary07
Copy link

This PR adds an optimized version of the bubble sort algorithm.
The optimization uses a 'swapped' flag that stops the algorithm
early if the array is already sorted, improving the best-case
time complexity from O(n²) to O(n).

  • Added optimized_bubble_sort.cpp
  • Added comments for clarity
  • Code follows repository style guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant