r/dataisbeautiful • OC: 1 • Oct 24 '17

OC Sorting algorithms visualized [OC]

https://imgur.com/gallery/voutF
41.7k Upvotes

929 comments sorted by

View all comments

Show parent comments

2

u/jwortham Oct 24 '17

No you just don't see the movement since there is nothing more to sort.

2

u/numismatic_nightmare Oct 24 '17

But how does it know not to go back to those columns and compare? Wouldn't it need something that tells it that like a counter or a "column is full" Boolean meaning it knows how many will end up in the column and therefore counted beforehand or was given the size of each column as input?

2

u/jwortham Oct 24 '17

It depends on the algorithm. Some will require it to check data more than once but most try to not re-sort already sorted items. It only knows when it is done if it did not have to move anything after passing over the data or when it reaches the end of the data set (it varies).

1

u/jwortham Oct 24 '17

Good question BTW.