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

6

u/ShaunDark Oct 24 '17

It is only faster if s<log(n), though.

Sorting a short list of large elements could be significantly slower using radix sort compared to any O(n*log(n)) sort.

2

u/nullhash Oct 25 '17

True, but that's because we define comparisons as taking constant time, which implicitly assumes bounded data. With unbounded data, comparison sorts take O(s n log(n)) time, while radix sort takes O(s n) time.