6 ms·
Well, I don’t think it is the point of the article, but we might as well list the most beautiful algorithms we can think of, right? Mergesort is quite beautifu
by bee_rider 2y ago
Well, I don’t think it is the point of the article, but we might as well list the most beautiful algorithms we can think of, right?
Mergesort is quite beautiful I think. There’s something beautiful in the simplicity of just merging the sorted lists. Stable. No pathological cases. Nice access patterns.
- 082349872349872 2y agoIIRC, Knuth said Tarjan's SCC had a certain beauty in that exactly when each node is visited, the relevant information has just been calculated.
- adastra22 2y agoEvolution by natural selection is the most beautiful algorithm imho.
- dumpsterdiver 2y agoI was looking for a word earlier that describes when it slowly dawns on a person how profound a thing is that’s been right in front of their eyes most of their life. The word I settled on was revelation, and one of the revelations I revisit as I grow older is the menacing terror presented by evolving lifeforms. If you press the fast forward button as a theoretical “survivor in the game of life”, the creatures that were benign when they were static now become terrifying, constantly morphing organisms which gain and lose all manner of sharp and venomous appendages. Like those early Deep Dream videos that always had creepy eyes and teeth everywhere on inanimate objects… that truly is what evolution looks like. It inspires instinctive fear of all the bad things, because that is exactly how it manifests. When you release the fast forward button though and come back to the present, what was creepy and terrifying before suddenly becomes magnificent. A living representation of localized perfection.
- adastra22 2y agoOnly in niches that get locked in an evolutionary arms race, as does sometimes happen but is not the norm. There’s also prokaryotic life out there chilling and doing the same thing it’s been doing for billions of years.
- tux3 2y agoWe owe everything to it, and yet it is twisted and wrong. Every day that passes, medicine weakens it. I thank medicine.
- ajuc 2y agoMedicine isn't weakening natural selection any more than birds' nests, bees' hives or beavers' dams are. It's all part of the optimized function.
- 082349872349872 2y agoYou can spot social Darwinists by hand-wringing that the "unfit" might paradoxically be outbreeding the "fit".
- adastra22 2y agoWhat a succinct summary of the problem, thank you.
- adastra22 2y agoWho invented medicine? The product of natural selection, that’s who.
- m463 2y agoFirst, do no harm. actually, it's interesting that not only does the oath not say that, but that doctors take all kinds of different oaths. They differ in all sorts of respects, and keep getting revised (like privacy policies). https://en.wikipedia.org/wiki/Primum_non_nocere https://en.wikipedia.org/wiki/Primum_non_nocere https://en.wikipedia.org/wiki/Hippocratic_Oath#Modern_versions_and_relevance https://en.wikipedia.org/wiki/Hippocratic_Oath#Modern_versio...
- adastra22 2y agoI don’t understand the relevance?
- bjornsing 2y agoEuclid’s algorithm [1] for finding the greatest common divisor of two numbers probably belongs on the list. As the name implies it was first described by Euclid, in 300 BC(!). It’s still widely used today. 1. https://en.m.wikipedia.org/wiki/Euclidean_algorithm https://en.m.wikipedia.org/wiki/Euclidean_algorithm
- zem 2y agothe shunting yard algorithm is beautiful. I also love flood fill, especially with a nice visualisation.
- rtheunissen 2y agoI love the various top-down binary search tree partition/split/join algorithms. https://github.com/rtheunissen/bst/blob/main/trees%2Fbalancers.go#L15 https://github.com/rtheunissen/bst/blob/main/trees%2Fbalance...