It will not happen in this implementation (but I appreciate to avoid known bugs) as we are only dealing with very small arrays. https://github.com/mszula/visual-sorting/blob/main/src/lib/sort-algorithms/quick-sort.ts In very large arrays "right + left" can overflow. `const pivot = items[Math.floor((right + left) / 2)];` FIX: `const pivot = items[Math.floor(left + ((right-left) / 2) )];` see https://en.wikipedia.org/wiki/Quicksort#Choice_of_pivot https://en.wikipedia.org/wiki/Binary_search#Implementation_issues https://research.google/blog/extra-extra-read-all-about-it-nearly-all-binary-searches-and-mergesorts-are-broken/
It will not happen in this implementation (but I appreciate to avoid known bugs) as we are only dealing with very small arrays.
https://github.com/mszula/visual-sorting/blob/main/src/lib/sort-algorithms/quick-sort.ts
In very large arrays "right + left" can overflow.
const pivot = items[Math.floor((right + left) / 2)];FIX:
const pivot = items[Math.floor(left + ((right-left) / 2) )];see
https://en.wikipedia.org/wiki/Quicksort#Choice_of_pivot
https://en.wikipedia.org/wiki/Binary_search#Implementation_issues
https://research.google/blog/extra-extra-read-all-about-it-nearly-all-binary-searches-and-mergesorts-are-broken/