Skip to content

Conversation

SenithVijayantha
Copy link

Description:

  • Updated the outer loop condition in the bubble method from i < arr.length to i < arr.length - 1.
  • This ensures the loop runs exactly n-1 times, eliminating the unnecessary final pass.
change outer loop condition in bubble sort from i < arr.length to i < arr.length - 1 to avoid unnecessary last pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant