Mental Model
Shell sort improves simple sorting by comparing elements far apart first, then reducing the gap to sort closer elements, making the list more ordered step by step.
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. This way, big mistakes get fixed early, making the final sorting easier.
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