Mental Model
Shell sort improves simple sorting by comparing elements far apart first, then reducing the gap to sort closer elements.
Analogy: Imagine organizing books on a shelf by first sorting every 3rd book, then every 2nd, and finally every book in order, making the final sorting easier.
Array: [8, 5, 3, 7, 6, 2, 4, 1]
Gap = 4 -> Compare elements 4 apart
Indexes: 0 -> 4 -> null
1 -> 5 -> null
2 -> 6 -> null
3 -> 7 -> null