Skip to content

Commit

Permalink
Add Oxford comma (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens-bot authored and mathiasbynens committed Oct 2, 2018
1 parent 59a7d4d commit 80c093f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/blog/array-sort.md
Expand Up @@ -175,7 +175,7 @@ The second pre-processing step is the removal of holes. All elements in the sort

Choosing a suitable pivot element has a big impact when it comes to Quicksort. V8 employed two strategies:

- The pivot was chosen as the median of the first, last and a third element of the sub-array that gets sorted. For smaller arrays that third element is simply the middle element.
- The pivot was chosen as the median of the first, last, and a third element of the sub-array that gets sorted. For smaller arrays that third element is simply the middle element.
- For larger arrays a sample was taken, then sorted and the median of the sorted sample served as the third element in the above calculation.

One of the advantages of Quicksort is that it sorts in-place. The memory overhead comes from allocating a small array for the sample when sorting large arrays, and log(n) stack space. The downside is that it’s not a stable algorithm and there’s a chance the algorithm hits the worst-case scenario where QuickSort degrades to O(n^2).
Expand Down

0 comments on commit 80c093f

Please sign in to comment.