If we Shellsort an array of length 9, and we start with an increment size of 5, which element (if any) will be skipped on the first pass due to being in a sublist of only one element?

4
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • "No elements are skipped"

There is an element that is skipped due to being in a sublist of length 1.

Recall that array indexing starts at 0, so the records are in positions 0 to 8.

0 is paired with 5, 1 with 6, and so on.

This means that the record in position 4 would have been paired with position 9 if there had been a position 9.