Mental Model
Shell sort improves simple sorting by comparing elements far apart first, then gradually reducing the gap to sort the list efficiently.
Analogy: Imagine organizing books on a shelf by first sorting every 4th book, then every 2nd book, and finally sorting all books one by one to get a neat order.
Array: [8, 5, 3, 7, 6, 2, 4, 1] Gap: 4 Indexes compared: 0 and 4, 1 and 5, 2 and 6, 3 and 7