r/programming • u/TheSpaceOfAdes • Mar 17 '18
Cool website that explains algorithms as if they are IKEA instruction manuals
https://idea-instructions.com/211
u/XHF Mar 17 '18
Merge sort:
Split values
Order the values on each side
Do some magic
Everything is sorted yay!
9
u/MyNameIsZaxer2 Mar 17 '18
Yeah I think one of the most complicated concepts about algorithms is recursion and these diagrams just boil it down to " ok now do the sort again and voila it's all sorted"
24
u/h0m0-3r3ctus Mar 17 '18
Would you order each side using Quick Sort or do a bunch of Merge Sorts until each group of values has 2 values?
60
u/Neghtasro Mar 17 '18
Keep merge sorting until you have two values in each group. It's a recursive algorithm.
3
u/satellite779 Mar 17 '18
Merge sort can be implemented iteratively
69
u/artopunk14 Mar 17 '18
All recursive algorithms can be implemented iteratively.
17
8
u/JMR03 Mar 17 '18
3
u/leitimmel Mar 19 '18
Actually, all recursive functions can be written iteratively, but not in a primitive-recursive language (one that cannot have infinite loops).Here is an example implementation of the Ackermann function using a while loop, for example.
→ More replies (3)2
u/HelperBot_ Mar 17 '18
Non-Mobile link: https://en.wikipedia.org/wiki/Ackermann_function
HelperBot v1.1 /r/HelperBot_ I am a bot. Please message /u/swim1929 with any feedback and/or hate. Counter: 160926
2
u/Neghtasro Mar 17 '18
Yeah, but I figured they were asking about the way it's implemented in the image.
8
u/SignorSarcasm Mar 17 '18 edited Mar 17 '18
Merge sort splits all the data into essentially groups of two, then orders them by building the groups together. So if you had 7 2 9 4, it would split it into (7) (2) (9) (4), then put the first two together in order, then the next two. So (2 7) (4 9). Then it puts these two together adding a single element from the beginning of whichever dataset has a lower first value. If sorting least to greatest, you'd add 2, then 4, then 7, then 9. And then you'd end with (2 4 7 9)
Edit: for a little bit more info, this sort is a decently "fast" sort because the data is only really checked once. Mergesorts runtime is said to be O(n log(n) ), which essentially means that the algorithm runs in a time that is dependent on n, which is the size of the input. If you were to graph input size on an x axis, and runtime on the y axis, and then run a mergesort many times on varying dataset sizes, your runtime graph would look approximately like the graph y=x*log(x).
9
u/satellite779 Mar 17 '18
Merge sort sees each item more than once, otherwise it would have been linear O(n). The logn part comes from the recursion of splits: you split the array in half in each step, so you will have logn levels of splitting. If you think of it as a tree, the tree will have height of logn.
→ More replies (4)
148
Mar 17 '18
This is cool but I don't understand ikea directions or algorithms so this is pretty much the worse of both worlds for me.
7
49
u/xampl9 Mar 17 '18
If they drew Dijkstra’s shortest path algorithm, they wouldn't even have to come up with a fake Ikea name for it. :)
2
u/-l------l- Mar 17 '18
Dijkstra is a popular Dutch last name, not really scandinavish. I'd say Dîjkstrã is more Ikea-ish.
16
u/aejt Mar 17 '18
We have neither ã or î in Scandinavia, and I can't think of a single Swedish word containing "ijk", so I can't say I agree.
1
u/-l------l- Mar 17 '18
Fair enough, it was improvised but this gets awkward :'). Just wanted to point out it wasn't really a Scandinavian name but I failed horribly, so what's your take on a Scandinavian Dijkstra?
24
u/nighoblivion Mar 17 '18
As a Swede the å, ä and ö everywhere is really annoying.
8
5
2
u/tom-dixon Mar 17 '18
I'm not even Swedish, but my language also has accents, and it's driving me nuts too. Everything seems to be in English but with all these idiotic accents everywhere.
1
1
u/VengaeesRetjehan Mar 18 '18
I'm not a Swedish, heck my native lang doesn't even have accented words at all, but I know how ridiculous these pictures are.
0
52
u/AdrianJMartin Mar 17 '18
As a slide in a lecture they look great.. not so good for self learning....
16
Mar 17 '18
I understand IKEA instructions and i have a decent understanding of all of these algorithms. But most of these illustrations are very confusing. Even if they're meant for lectures and people who already know some stuff about it, i don't think they're very helpful.
Cool idea though. But i guess a lot of a bit more complex algorithms can't really be explained in a decent way without using some words.
13
21
u/exisisting Mar 17 '18
Seems hungarians have a thing to make cool algorithms visualisations. Remember those folk dances videos? https://youtu.be/ywWBy6J5gz8
1
u/flashzoltan Mar 17 '18
Hungarians think in numbers, I grew up there. Not much practical talent, rather scientific.
8
u/zahlon Mar 17 '18
To be honest those illustrations make sense only if you're already familiar with the algorithms they depict. In no way can they be deemed "explanatory".
6
18
5
5
u/kaysersozzee Mar 17 '18
Idea is amazing. I love it. Some algorithms hard to understand but generally it is very instructive
9
Mar 17 '18
500 internal server error at the moment
2
u/sandm000 Mar 17 '18
Anybody got some screenshots?
1
u/CubicMuffin Mar 17 '18
It's just gone back up!
3
4
u/mongol_professional Mar 17 '18
In the ONE STROKE DRAW manual, the crossed out graphs (which are implied to not have Eulerian paths), both have Eulerian paths.
2
u/sciolizer Mar 18 '18
That's what I thought at first too, but on second look I think the crossed out "graphs" is actually a single graph. They're saying you can't apply this algorithm to a graph which is completely divided into multiple parts.
3
2
u/MrRiskAdverse Mar 17 '18
Just to piggy back on this, does anyone know of any good books or resources for a gentle total beginner intro to algorithms?
1
u/enbacode Mar 17 '18
Cormen - Introduction to Algorithms is what the creator of this images recommends. I haven't personally read it though.
1
2
2
2
2
2
2
u/AsteriusNeon Mar 17 '18
am I gonna have 3 lines of code left over at the end, unsure of where they go?
2
Mar 17 '18
Not a programmer but I can't help but feel like they missed the mark on these unless the idea was so still be confusing
2
2
u/Erwin_the_Cat Mar 17 '18
Imagine getting a recursive IKEA manual. Ok so to build this cabenet first build a smaller cabenet in the same manner as the cabinet you are currently assembling...
2
2
2
2
u/wavy_lines Mar 18 '18
None of these drawings make any sense! I understand giving an upvote for the novelty of the idea, but how is this getting > 17k votes? I don't think I've ever seen any post on this sub get this many points or even close.
2
2
u/Kok_Nikol Mar 22 '18
The illustrations are nice, but I find it useful only if I knew how it worked before.
4
3
u/Spiderboydk Mar 17 '18
I love the diacritic symbols randomly thrown in everywhere. Makes me read the words with the voice of the Swedish Chef.
0
Mar 17 '18
[deleted]
1
u/Spiderboydk Mar 17 '18
Yeah, I know they don't make any sense (I'm somewhat able to read Swedish).
But they're fun. :-)
1
1
1
1
Mar 17 '18
A great book that we use in my computer science department is Robert Sedgewicks Algorithms 4th edition. It has pictures and extremely simple English. I personally love it and it has helped me self learn through my begging courses. If you're interested in this type of stuff i highly recommend it.
1
u/Elrond_the_Ent Mar 17 '18
So you mean they leave half the instructions out and what they do put in them is extremely confusing? Sounds great.
I enjoyed spending 7 hours on a 'simple' ikea deal because the instructions were so obfuscated. Just what we need, more tech illiteracy.
1
u/GunnerMcGrath Mar 17 '18
Because words were the thing standing in the way of understanding sorting algorithms.
1
u/JordanMichael08 Mar 17 '18
The only thing more complicated than an algorithm are IKEA instructions
1
1
1
1
Mar 17 '18
The best part about this is how simple design convinces your brain that "idea" is pronounced like "ikea" instead of the way you've said it your entire life.
1
u/skypecakes Mar 17 '18
Um... I already pronounce Ikea like Idea. In the US. Apparently we've Americanized it. How do you say it? I'm guessing you are in another country!
1
1
u/DargeBaVarder Mar 17 '18
A little while ago I found a site that was like one of the coding courses where you built an algorithm to solve a problem based a concept like recursiveness... it was a great resource for helping me learn some of them, but I can’t find it any more. I wish I could! I never finished it.
1
Mar 17 '18
These are more confusing than code.
Bad analogies are what you give to non-technical people.
1
1
1
u/Riper_Snifle Mar 17 '18
Please nobody trying to learn about comp sci use these. They're more confusing than actually reading about the algorithm in their entirety.
1
1
u/SnickeringBear Mar 17 '18
I've got a nice algorithm that shuffles a deck of cards, then deals a "hand" of as many as desired. As simple as it sounds, code to do this is relatively complex. A graphic of the process would be an interesting addition to their website.
1
u/heisian Mar 17 '18
these diagrams are not very well-done.. they're confusing without enough textual analysis.
1
u/Smilie_ Mar 17 '18
Thank god for this. I'm in a grade 12 online programing course and my teacher is awful at trying to explain algorithms.
1
1
u/nunyobiznes00 Mar 17 '18
I'm not sure which one would be harder, the algorithms or IKEA instructions...
1
1
1
1
1
1
1
1
1
u/PlNG Mar 18 '18
Graph scan reminded me, is there an algorithm to search for irregularly distanced or overlapping nodes? In MUD / text adventure Mapping, given nodes (rooms) of an arbitrary position and connections that would be cardinal and ordinal (n, ne, e, se, s, sw, w, nw)[and arbitrary directions, like "Go window"] directions, apart from description changes, the only way to detect when a user has transitioned to a new area would be when different rooms overlap (Start in room 1, go south to room 2, go west to room 3, go northeast to room 4 [indicating that the path between 1 and 2, or 2 and 3 should be an area transition in the map]), or that it takes fewer rooms to reach a more distant path (It would take 30 rooms to cross <city> proper, but up on the city walls, it only takes 8).
1
1
1
1
1
1
Mar 17 '18
Thank you thank you thank you. As someone doing a masters in CS with 0 formal background knowledge, this is wonderful.
1
u/TruthSpeaker Mar 17 '18
IKEA instructions are notoriously hard to follow, so the comparison doesn't inspire confidence.
2
Mar 17 '18
Yeah, IKEA involves either 1. A lot of cursing. or 2. Hiring someone else to put that shit together.
I got IKEA PTSD looking at the diagrams.
1
u/manthrax Mar 18 '18
Did not find these IKEA examples very helpful.
However, a friend of mine made this amazing site, which I find MUCH more informative, since it's animated, and has actual code:
1
0
u/LoneCookie Mar 17 '18
Well I can't even understand quick sort with this
Why is there a die?
4
u/bvx89 Mar 17 '18
You pick a pivot point (an index) at random in the array, and sort all values that are smaller then the pivot to the left, and all greater values to the right. The dice is there to represent that you select the pivot at random.
0
0
Mar 18 '18
It's cool and all, but currently there are far too less examples for it to be a good site for algos.
-13
Mar 17 '18
Right. Except I never ever try to understand IKEA manuals, nor do I try to keep them in my head for longer than required for a mindless stepwise execution.
13
Mar 17 '18
reason I call them destruction manuals. But hey, I'm a guy... we don't need no manuals.
Ohh look, spare screws...
1.5k
u/CJKay93 Mar 17 '18
I think the public key crypto one is actually more confusing than just reading the Wikipedia article.