Lurker News

Comments (491) 209 threads

Earlier comments
meuk2 replies#
Euclid's GCD algorithm, and Russian peasant multiplication.
meuk#
Yup. Applying Russian multiplication to matrices is surprisingly effective for evaluating recursive relations (it can evaluate the nth Fibonacci number in O(log n)) Karatsuba is also a nice 'proof-of-concept' algorithm (it shows that it is possible to do better than O(n^2) at multiplication in the simplest way possible) that's also very practical - and it has a nice anecdote behind it :)
yesenadam1 reply#
I like this version of the Euclid algorithm:

Make a rectangle with side lengths of 2 positive real numbers. Put the biggest square inside (i.e. against a short side) that you can, add as many as fit. If there's still a gap, put the biggest square that fits in that, repeating until filled.. If you never fill the gap, the ratio is irrational. The number of squares of each size used gives the ratio's continued fraction.

hikarudo#
Though it's a learning model, not an algorithm: Support Vector Machine. I love the geometric intuition behind max-margin hyperplanes leading to good generalization.
greenpizza131 reply#
I love the Sieve of Eratosthenes. Even if it's not the most optimal, I find it a very clever and beautiful way to find prime numbers up to a given point.
chillee#
So the typical sieve of Eratosthenes is O(N log log N). Perhaps surprisingly, you can actually write a sieve that's O(N).
larrydag#
Naïve Bayes. A prediction algorithm that can be developed from simply creating hash tables. Very neat and elegant and results are pretty darn good.

Load more comments