Live data from Hacker News

Ask HN: What's your favorite elegant/beautiful algorithm?

news.ycombinator.com

171–180 of 507 posts

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#171
I like the A* pathfinding algorithm. It's not particularly elegant or beautiful on itself, and it's very dependant on the heuristics applied & the topology of the terrain used. Yet the results tend to be quite pleasing to watch.

Also, it has a great website dedicated to it, with lots of interactive demos:

http://theory.stanford.edu/~amitp/GameProgramming/

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#174

I always push my devs to really study the Bittorrent protocol. The elements of the protocol are all fairly easy to understand, but it's gorgeous to see how elegantly it solved a social problem rather than a computational problem. The tit-for-tat and fast-finish protocols are incredibly graceful ways to create virtuous cycles in a social/technical hybrid, and replaced very real vicious cycles in previous protocols. Va…

Any suggestions where I can read about the BitTorrent protocol?

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#175
I have always liked DBSCAN: https://en.wikipedia.org/wiki/DBSCAN

DBSCAN is used for clustering in applications, much like k-means clustering, but in k-means clustering, the number of clusters must be known in advance (hence the k)

DBSCAN solves this problem by for every point in the graph checking if a certain threshold of vertices is within a certain radius. If this is the case, it will add these vertices to the new cluster and repeat the process for these nodes. It is very simple, so much that you can easily explain this to non-technical people.

In my previous job I used it for detecting whether for one word in a signal there only existed one representation or multiple (used for toggle bit detection)

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#176
post #174

I always push my devs to really study the Bittorrent protocol. The elements of the protocol are all fairly easy to understand, but it's gorgeous to see how elegantly it solved a social problem rather than a computational problem. The tit-for-tat and fast-finish protocols are incredibly graceful ways to create virtuous cycles in a social/technical hybrid, and replaced very real vicious cycles in previous protocols. Va…

Any suggestions where I can read about the BitTorrent protocol?

I would be interested in that too :)

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#177
post #174

I always push my devs to really study the Bittorrent protocol. The elements of the protocol are all fairly easy to understand, but it's gorgeous to see how elegantly it solved a social problem rather than a computational problem. The tit-for-tat and fast-finish protocols are incredibly graceful ways to create virtuous cycles in a social/technical hybrid, and replaced very real vicious cycles in previous protocols. Va…

Any suggestions where I can read about the BitTorrent protocol?

There is an official document on the protocol [0], but it doesn't go much into the details. Theory.org's resource [1] does a much better job.

[0] - http://www.bittorrent.org/beps/bep_0003.html

[1] - https://wiki.theory.org/index.php/BitTorrentSpecification

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#178
post #8

Diffie–Hellman. I know that cryptography can get much fancier and more clever, but Diffie–Hellman took a concept my intuition told me was impossible and showed that it's possible in a really simple, elegant way. Learning about it was the first time I realized how beautiful the math behind computer science is. It's also a great insight into just how fundamental the concept of computational complexity is.

Thank you for this. This probably ranks as the algorithm with the greatest coolness / simplicity ratio I've heard of.

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#179

I always push my devs to really study the Bittorrent protocol. The elements of the protocol are all fairly easy to understand, but it's gorgeous to see how elegantly it solved a social problem rather than a computational problem. The tit-for-tat and fast-finish protocols are incredibly graceful ways to create virtuous cycles in a social/technical hybrid, and replaced very real vicious cycles in previous protocols. Va…

> The elements of the protocol are all fairly easy to understand, but it's gorgeous to see how elegantly it solved a social problem rather than a computational problem.

One more protocol / paper which fits this description, imo, is Bitcoin paper [0]. It's easy and accessible to all and elegently explains how to solve a complex problem with existing tools. Not sure it can be called as an 'algorithm'

[0] - https://bitcoin.org/bitcoin.pdf

Re: Ask HN: What's your favorite elegant/beautiful algorithm?

#180

Gaussian integration. You might have heard of "2nd order" or "4th order methods to calculate an integral. This means that the error drops off with the number of sampling points like N^-2 or N^-4, respectively. But Gaussian quadrature has spectral accuracy, which transcends this measure. Error goes down like an exponential of N. Another neat feature is polynomials of degree 2N-1 or less are integrated exactly with thi…

https://en.m.wikipedia.org/wiki/Clenshaw–Curtis quadrature is similarly fun.
Post reply on HN