"The worst algorithm in the world?"
bosker.wordpress.com
"The worst algorithm in the world?"
1–10 of 73 posts
Re: "The worst algorithm in the world?"
#2The title is hyperbole (I'm sure that I've written much, much worse algorithms, many times), but the breakdown of Fibonacci sequence algorithms is really enjoyable.
Re: "The worst algorithm in the world?"
#3Interesting writeup, thanks. OT: For all its fame, has any of you ever needed to calculate Fibbonacci numbers in real life? I haven't.
Re: "The worst algorithm in the world?"
#4Interesting writeup, thanks. OT: For all its fame, has any of you ever needed to calculate Fibbonacci numbers in real life? I haven't.
It seems like I had to as part of an interview once. Still, I have needed to write recursive functions many, many times and it's good to review some of what can go wrong.
Re: "The worst algorithm in the world?"
#5I always liked the sort where you randomize the elements, check to see if they're sorted, and if not try again.
Re: "The worst algorithm in the world?"
#6I always liked the sort where you randomize the elements, check to see if they're sorted, and if not try again.
Yeah, I recalled the name as random sort, and was pleasantly surprised when the bogosort link directed to the same algorithm. I particularly enjoyed the "Quantum Bogosort" algorithm on the Wiki page.
Re: "The worst algorithm in the world?"
#7Dunno. IIRC Every time I have seen the "bad" Fibonacci recursive algorithm has been followed by the "good" recursive one (bottom-up), which is O(1) in size if your language/implementation does tail-call elimination...
Re: "The worst algorithm in the world?"
#8It seems the author hasn't read SICP:
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html...
Re: "The worst algorithm in the world?"
#9> It’s not just bad in the way that Bubble sort is a bad sorting algorithm; it’s bad in the way that Bogosort is a bad sorting algorithm.
Nonono, Bogosort is way worse than naive recursive fibonacci - the former doesn't even guarantee termination, recursive fibonacci still does.
If you want to calculate fibonacci numbers not as a misguided exercise in algorithms but actually efficiently, use an algebraic form: http://en.wikipedia.org/wiki/Fibonacci_number#Computation_by...
Re: "The worst algorithm in the world?"
#10In a somewhat similar genre, I enjoyed this paper on computing primes, and some of the very-inefficient algorithms that have been used for such purposes (often mislabeled as the "sieve of Eratosthenes"): http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf