Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Conversation

jayeshcp
Copy link
Contributor

@jayeshcp jayeshcp commented May 3, 2016

  1. Previous solution performed O(N ^ 2) iterations for sorted input. This fixes it by exiting loop if array is already sorted and performs at most O(N) iterations in this case.
  2. Renamed class name from bubbleSort to BubbleSort.

jayeshcp added 3 commits May 3, 2016 13:13
Previous solution performed `O(N ^ 2)` iterations for sorted input. This fixes it by exiting loop if array is already sorted and performs at most `O(N)` iterations in this case.
BubbleSort: Fix to reduce number of iterations for sorted array as input
@blakeembrey blakeembrey merged commit cd4b3bf into blakeembrey:master May 3, 2016
blakeembrey pushed a commit that referenced this pull request Sep 29, 2017
…put (#168)

Previous solution performed `O(N ^ 2)` iterations for sorted input. This fixes it by exiting loop if array is already sorted and performs at most `O(N)` iterations in this case.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants