javascript-algorithms icon indicating copy to clipboard operation
javascript-algorithms copied to clipboard

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

Open talentedandrew opened this issue 6 years ago • 2 comments

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

talentedandrew avatar Dec 09 '18 19:12 talentedandrew

Can I work on this issue ?

snehsumant avatar Jul 31 '20 18:07 snehsumant

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

gkhedekar5758 avatar Jun 20 '22 15:06 gkhedekar5758