Skip to content

Break if the collection is sorted - #321

Merged
harshildarji merged 1 commit into
TheAlgorithms:masterfrom
aldokkani:master
Jun 25, 2018
Merged

harshildarji merged 1 commit into
TheAlgorithms:masterfrom
aldokkani:master

Conversation

@aldokkani

Copy link
Copy Markdown

The current implementation efficiency is O(n^2) always.
Now it allow for better performance, for example when the collection is already sorted or slightly disordered. It can achieve Best case performance O(n).

@harshildarji
harshildarji merged commit d4b4b7b into TheAlgorithms:master Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants