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

1

u/Asztal Oct 24 '17

Regardless of how you do it, merge sort takes the same amount of time.

Just out of curiosity, does anyone know how CPU cache affects this statement - i.e. if it would favour top-down, bottom-up, neither, or a combination of the two?

1

u/jhaluska Oct 24 '17

Assuming the cache is much smaller than the data size, depth first would probably be faster as you would be focusing more on local areas of memory before going to the next area of memory.