Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuickSort : Instead of taking pivot as 1st element, we should take the pivot as last element, due to time complexity #265

Open
talentedandrew opened this issue Dec 9, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@talentedandrew
Copy link

Instead of this
const pivotElement = array.shift(); // O(n)

we should use
const pivotElement = array.pop(); // O(1)

When taking the pivot as last element 2 test cases are failing.

  1. QuickSort › should do stable sorting
  2. QuickSort › should visit NOT SORTED array element specified number of times
@trekhleb trekhleb added the enhancement New feature or request label Dec 10, 2018
@snehsumant
Copy link

Can I work on this issue ?

@gkhedekar5758
Copy link

i would like to take this. can someone assign it to me please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants