this post was submitted on 24 Apr 2024
61 points (98.4% liked)
Programmer Humor
19649 readers
2678 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Technically, sleep sort is O(n), so faster than the theoretical optimal sorting algorithm O(n.log n) ... not so bad ;)
Sleep sort is kind of like count sort but with added overhead. Both have a complexity of O(n+m) with n being the length and m the value of the max element.
The optimum of O(n * log n) is based on the assumption that the only information about the values is obtained by comparison. If you operate on integer keys I would recommend radix sort. It has a complexity of O(n * w) where w is the length (read logarithm) of the key.