by EFruit on 1/29/17, 11:53 PM with 89 comments
My current favorite is SWIM. https://www.cs.cornell.edu/~asdas/research/dsn02-swim.pdf
by theemathas on 1/30/17, 5:50 AM
Abstract: An algorithm M is described that solves any well-defined problem p as quickly as the fastest algorithm computing a solution to p, save for a factor of 5 and low-order additive terms. M optimally distributes resources between the execution of provably correct p-solving programs and an enumeration of all proofs, including relevant proofs of program correctness and of time bounds on program runtimes. M avoids Blum's speed-up theorem by ignoring programs without correctness proof. M has broader applicability and can be faster than Levin's universal search, the fastest method for inverting functions save for a large multiplicative constant. An extension of Kolmogorov complexity and two novel natural measures of function complexity are used to show that the most efficient program computing some function f is also among the shortest programs provably computing f.
The catch is that the constants in the big-O are enormous.
by DDR0 on 1/30/17, 7:10 AM
There's a way to do it in O(1) space, though.
If you start off two runners in the list, and each "step" move one twice and the other only once, if there's a loop they will eventually run into each other and be processing the same element. Simple, elegant, and nothing I'd have ever thought of. :)
by wmu on 1/30/17, 8:11 AM
[1] https://en.wikipedia.org/wiki/LZ77_and_LZ78 [2] https://en.wikipedia.org/wiki/Rsync#Algorithm [3] https://en.wikipedia.org/wiki/Gift_wrapping_algorithm [4] https://en.wikipedia.org/wiki/XOR_linked_list
by cperciva on 1/30/17, 5:59 AM
by toomanybeersies on 1/30/17, 5:57 AM
It was probably the algorithm that cemented my love of computer science, it's such an elegant solution to a problem and so simple once you understand it.
by daurnimator on 1/30/17, 5:15 AM
by kul_ on 1/30/17, 4:41 AM
by jnpatel on 1/30/17, 5:10 AM
by ewwertee2454 on 1/30/17, 4:06 AM
by elihu on 1/30/17, 5:39 AM
Whitted's recursive ray tracing algorithm https://en.wikipedia.org/wiki/Ray_tracing_(graphics)#Recursi...
PageRank
by 110011 on 1/30/17, 8:35 AM
Search for the paper by Adam Kalai on how to generate random factorized integers easily. It uses log^2 n primality tests an average. The result is originally by Eric Bach who managed it using only log n primality tests but using a more complex algorithm.
by gwicks56 on 1/30/17, 6:48 AM
One of those algorithms where you go "Shit so obvious and also so completely genius that I could never have thought of it"
Also, the internet as we know it would not work without it
by aserafini on 1/30/17, 7:14 AM
by rbritton on 1/30/17, 5:29 AM
PHP implementation: https://github.com/bandwidth-throttle/token-bucket
by zelah on 1/30/17, 12:49 AM
Parallelizable and efficient method for producing high quality pseudo random bits.
Designed to achieve maximal period (with 500 bit state the period of repetition is one less than 2^500).
Can be run backwards or forwards. Running it backwards undoes running it forwards and reproduces the pseudo random bits in reverse order.
by NTDF9 on 1/30/17, 1:54 AM
A modified version of it is used in most CPU register out-of-order execution
by gjvc on 1/30/17, 12:24 AM
https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transf...
by akkartik on 1/30/17, 8:06 AM
by ryandrake on 1/30/17, 7:47 AM
by pedrorijo91 on 1/30/17, 9:29 AM
by bananicorn on 1/30/17, 12:20 PM
[0] http://www.geeksforgeeks.org/fleurys-algorithm-for-printing-...
by 110011 on 1/30/17, 8:25 AM
It shows the importance of making a good definition and thinking differently (for the run time analysis I thought for a while and failed to come up with an argument why it runs in linear time, but once you see it differently it's obvious :))
I only recently had the chance to understand this algorithm. Here's a little (annotated) gist I made after understanding it: https://gist.github.com/quantumelixir/3c410dd4a0afe0f2514e0f...
by pmalynin on 1/30/17, 5:35 AM
The algorithms for computing it are beautiful and have enabled much of the technology we see around us today.
by haidrali on 1/30/17, 7:34 AM
by drewmate on 1/30/17, 8:13 AM
The algorithm itself is interesting enough, but when applied to bipartite graphs, you can solve some tough problems very efficiently. For instance, one of my favorites is how Santa could possibly match a million kids with a million different gifts in order to maximize happiness. It turns out you structure the problem as a bipartite graph with nodes on one side for gifts and children on the other, and Ford-Fulkerson can guarantee the best matching in polynomial time (no small feat, given how many possible combinations there are!)
by syntaxing on 1/30/17, 1:35 PM
[1] https://en.wikipedia.org/wiki/Combinatorial_optimization [2] http://gizmodo.com/5934150/the-algorithm-that-controls-your-...
by deepnotderp on 1/30/17, 5:51 AM
by jones1618 on 1/31/17, 5:40 AM
"An elegant method for resolving collisions in hash tables... It has the rare distinction of being easy to implement and efficient both in theory and practice."
It does an amazing job of packing values into N hash tables so there's very little dead space but lookups are very fast.
by ww520 on 1/30/17, 7:30 AM
by sAbakumoff on 1/30/17, 7:23 AM
mostly because they clearly demo the power of human brain.
by jetti on 1/30/17, 4:31 PM
It is what is used in ML based languages to infer type and apparently Haskell uses it a bit too
by taeric on 1/30/17, 6:40 AM
He recently updated his implementation. Is very fun to read his notes on his implementation. In particular, he discusses things he had wrong.
If you like poor JavaScript implementations, I can post mine again.
by Mr_P on 1/30/17, 5:06 AM
by santaclaus on 1/30/17, 6:20 AM
by notforgot on 1/30/17, 1:31 AM
by rurban on 1/31/17, 2:58 PM
by useanalias on 1/30/17, 5:55 AM
by nojvek on 1/30/17, 6:53 AM
I also was fascinated as shit when I learnt about minimax and alpha beta search.
Game theory and neural nets have always fascinated me.
by kovrik on 1/30/17, 6:09 AM
by wfunction on 1/30/17, 7:41 AM
by pizza on 1/30/17, 5:15 AM
by wwwhatcrack on 1/30/17, 8:20 PM
by jakeogh on 1/30/17, 7:58 AM
by CalChris on 1/30/17, 6:23 AM
RSA.
by deepnotderp on 1/30/17, 5:51 AM
by chaotic-good on 1/30/17, 6:08 AM