News for hackers. Stuff that matters.
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by gregordv on Wednesday October 17, 2018 @07:26AM (#18237986)
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.

Various TCP backoff algorithms are also a great study in how to approach problems with insufficient knowledge of the system under test, and building desirable properties (reliable in-order delivery) from a undesirable input (arbitrary packet loss, and loss in the face of congestion). I make all the kids try to implement their own, then walk through the history of TCP approaches to the modern day.

Re:Ask HN: What's your favorite elegant/beautiful algorithm? by avinassh on Wednesday October 17, 2018 @07:56AM (#18238101)
> 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? by ArtWomb on Wednesday October 17, 2018 @09:18AM (#18238628)
BitTorrent is foundational to the rise of decentralized stores and sharing: IPFS, Dat Protocol, WebTorrent, Storj, Holochain, etc.

An Introduction to Kademlia DHT & How It Works

http://gleamly.com/article/introduction-kademlia-dht-how-it-...

Re:Ask HN: What's your favorite elegant/beautiful algorithm? by luxcem on Thursday October 18, 2018 @04:43AM (#18246895)
DHT Algorithms are nice, the Chord is really simple and easy to understand.
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by dmihal on Wednesday October 17, 2018 @07:43AM (#18238057)
Any suggestions where I can read about the BitTorrent protocol?
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by avinassh on Wednesday October 17, 2018 @07:53AM (#18238088)
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? by war1025 on Wednesday October 17, 2018 @12:37PM (#18240783)
I implemented a BitTorrent client as a sophomore in college, available here: https://github.com/war1025/Torrent

It worked pretty well. Used it for several years until I started making real money and decided I could buy things rather than pirate them.

I had only been coding for a year or two at that point, so it is probably filled with lots of odd choices, but it also isn't super optimized like I would guess the more well known clients might be, and so might be easier to parse.

Re:Ask HN: What's your favorite elegant/beautiful algorithm? by otachack on Wednesday October 17, 2018 @03:34PM (#18242894)
I'm the same way in that I haven't been using torrents in awhile. But a few legit things they're used for us Linux distros so if you ever feel like helping in that endeavor you can seed out some ISOs.
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by ivanstame on Wednesday October 17, 2018 @07:53AM (#18238085)
I would be interested in that too :)
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by tombert on Wednesday October 17, 2018 @11:16AM (#18239888)
I second this; Kademlia has always struck me as one of the most beautiful and elegant algorithms out there; Bittorrent is wonderful too.
Re:Ask HN: What's your favorite elegant/beautiful algorithm? by solidr53 on Thursday October 18, 2018 @12:49PM (#18249890)
Bencode is such a piece of junk though.