73 points · by pplonski86 · 7y ago · 42 comments
Then we can take any randomized algorithm and, for its random values, use mix(real_rng.random(), Ackermann(5, 5)).
This fails that criterion, as you can just throw away all the calls except badsort 0.
My criterion isn’t well defined, because what you can statically know isn’t well defined, but I know a cheater when I see one :)
It seems like the tricks from this competition would be reusable for the slowest algorithm competition.
Wouldn't that necessarily be slower than all other algos, and also demonstrably be sorting, and - if each other algo's termination is bounded - have a bounded termination time.
It might not terminate for all lists, in theory; you could have a watchdog to cure that I think.
sort ≡ head ∘ sort ∘ permutations
I wonder if there is some neat (and totally useless) algorithm for sort using that info.It creates the whole monolithic expression with all the parenthesis in pessimal positions, forcing all the comparisons in the wrong order (back to front, aka least-significant-bits first), which makes it impossible to use the short circuiting of lexicographical comparisons.
While list not sorted { Random(list) }
?
for x in 3 1 2 5 4; do (sleep $x; echo $x) & doneThe great thing about this algorithm is that the same piece of code does all these things. There isn't a separate bodge for checking whether something is sorted.
Agreed theres no guaranteed bound, that's my basis for suggesting it as worst.
The worstsort in the post has a much worse expected runtime than the sort you described. You could make the bound not guaranteed by randomly deciding whether to throw out the result and start over at the end.