744
Not my problem sort
(infosec.pub)
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.
Guaranteed to sort the list in nearly instantaneous time and with absolutely no downsides that are capable of objecting.
You still have to check that it's sorted, which is O(n).
We'll also assume that destroying the universe takes constant time.
In the universe where the list is sorted, it doesn't actually matter how long the destruction takes!
It actually takes a few trillion years but its fine because we just stop considering the "failed" universes because they will be gone soon™ anyway.
Eh, trillion is a constant
amortized O(0)
Well yeah just delete the pointer to it!
universe.take()
Except you missed a bug in the "check if it's sorted" code and it ends up destroying every universe.
There's a bug in it now, that's why we're still here.
You still have to check that it's sorted, which is O(n).
We'll also assume that destroying the universe takes constant time.