What's your favorite algorithm, and why?
Algorithms
the algorithm to determine whether or not op is a faggot
return true
funnelsort
union-find
pake authentication
push-relabel maximum flow
pratt's expression parsing
quickperm
runge–kutta
Sleep sort
Probably mergesort. For some reason I like it better than quicksort. But both are easy enough to remember and implement should the need arise.
Also, Dijkstra. Basically just dynamic programming. Very elegant.
Explosion sort
huffman coding, it's so elegant
quicksort because im autistic and it's easy to implement
Recursion is the gayest shit ever I hate programmers who jerk themselves off over it.
Bitonic sort blew my mind
Concurrent write sort is just the right amount of stupid, being O(1)
But I don't know enough algorithms to really be able to pick a favourite one. Distributed ones are always nice (distributed leader election, distributed spanning tree construction, etc.) but there's probably a ton of stuff I don't know about.
Like , what is that
simplex noise
Bogosort master race
slowsort
quicksort, obviously
FFT
>Like , what is that
Imagine you encode characters according to how popular they are in a written language, you encode the most common characters with as few bits as possible. (Something like a space would maybe be represented as a 0 since it is the most common, then something like e might be 1 or 10 or whatever).
Now you have a nice way to compress text.
>Also, Dijkstra. Basically just dynamic programming. Very elegant.
Anything involving graph theory is woke
FFT for sure. Surely the greatest achievement in algorithms in the 20th century - without it we'd not have modern telecommunications.
Hello world
The joke is awful but that does not change the fact that recursion is cool and you're a faggot
It's a nice way for geniuses to flex in functional languages
Quicksort isn't hard but it's easy? Bubble sort is easy.
Kalman Filter
FFT
Convex Hull
Gaussian Elimination
Power Set
for(int i = 0; i < 10; i++)
{
if(i == 0 || i == 1 || i == 2 || i == 3 || i == 4 ||
i == 5 || i == 6 || i == 7 || i == 8 || i == 9 )
{
Console.WriteLine(i);
}
}
Fast inv square. If your jaw didn't drop when you first saw that shit you need to get off this board.
1. find razor
2. find forearm
3. ???
4. profit
By algorithm, I think OP meant correct algorithm.
Cancer
Fizzbuzz cause it's the only one I know
pratt parsing blew my fuckin' mind when I took NLP. Blew my dick off when I got into the real world, though. Nasty debugging
what the fuck?
Binary Search
multidimensional range queries on a lazy propagation segment tree because it sounds badass
i guess shunting yard
Aho-Corasick. Any algo that can turn a quadratic solution into a linear is fucking cool IMO.
>autism the algorithm
i like trains
FizzBuzz
Any sort that is built into the language
Heapsort was so cool when I first saw it.
Simplex for linear programming is also really neat too.
Runge katta? Damn son do diffeqs have many applications in cimpsci/compeng?
quaternions were run thing to learn about
Unfortunately not many
Hello world
cocktail sort
interval scheduling algorithms are pretty funny because you can add a few seemingly innocent requirements that take it from "very fast" to "cannot practically be computed in our lifetime"
Based.
heap sort is top tier
>o(nlogn), stable, and in place
also any greedy algorithms
oh sorry didnt mean stable as in retains order for similar keys in the unsorted list, i meant as in its big theta, tightly bounded, like merge sort
Karger's algo
Matrix chain multiplication in O(nlogn)
Checking if perfect matching exists by checking if determinant of tutte matrix of graph is indeitically zero usinf Schwartz–Zippel lemma
radix sort for fixed width elements
>O(n)
also extremely good, handmade hero implemented radix sort for nonnegative floats one day with 4 base 256 iterations
There I was, thinking "No, this can't be, I even know the proof why comparison-based.. oh, right."
Actually didn't know this. Thanks.
fizzbuzz and bubble-sort
Bubblesort, because I'm too fucking dumb to understand good algorithms.
Hopesort.
You swap one random element each iteration and hope it eventually becomes sorted.
Wouldn't it be better to swap, well, *two* elements? Swapping just one seems, excuse me, hopeless.
>O(n*9999*rand(1, 10))
EDF
it's the most obvious stuff you can come up with and it's still the best.
>sleep sort doesn’t work
>tfw you implemented a Pratt parser and didn’t even realize it
> you have 10 min to implement this quicksort for this interview and no you can’t use a partition function
Merge is comfy though I use quick more
Dijkstra, not only it's nice and useful everyday, but this guy made his cool shit while shopping with his girlfriend, fucking woke.
Heapsort is N*logN and inplace.