I recently read this Quora post about Bogosort which tries to sort a list using the following algorithm:
- Put the elements of the list in a random order.
- If the list is sorted, finish. Otherwise go to Step 1.
It has an average running time equal to O((n+1)!)
. And, it may run forever.
Can someone share more algorithms which became famous due to their dumbness?
Could you define dumb? I thought that is inefficient, not dumb.
As I mentioned, I read the post from Quora. I used 'dumb' to maintain a commonality with the original post.
I think I got a lot of downvotes because of using that word. In reality, I never meant it to be derogatory. I posted it as fun and was hoping to find algorithms which are so non-optimal that they cannot be used in most of the real life situations.
I am sorry if I offended you and will be careful of what I post from now on.
This one may be good contender
Thanks for the great insight. Will work towards getting better.
Actually, this is the fastest sorting algorithm according to it's best case performance. Since random shuffle is liniar and there's always a chance that the first shuffle with sort the array — we have
linear
complexity :)