Mark As Completed Discussion

As mentioned, we'll be doing some swapping once the partitions are properly arranged. At a high level, using this strategy, we'll start with three groups:

  1. Index 0 to low - this is the "bottom group"
  2. Index low to mid - this is the "middle group"
  3. Index mid to high - this is the "top group"

The idea is to set these initial groups, and then have the top "grow downwards" -- meaning to swap and properly assign the elements in each group, from top to bottom. So we'll see a line like this get executed:

JAVASCRIPT
1swap(arr, mid, high--);

Same with the bottom, except reverse, the bottom will grow bottom-up:

JAVASCRIPT
1swap(arr, low++, mid++);