Hacker News new | ask | show | jobs
by waldrews 5254 days ago
wait, shell sort is stable?
1 comments

No, it is unstable. The striding means that two equal elements can easily be reordered. For example, after 2-sorting [(2,a), (1,b), (1,c)] by the first component you get [(1,c), (1,b), (2,a)].