The algorithmic trick that solves Rubik’s Cubes and breaks ciphers
What do the Rubik’s cube and a cipher from the 70s have in common? Let’s find out.
Our Patreon:
0:00 Rubik’s cube
9:40 DES
------------------------
Links:
Feliks setting the record
webpage “God’s number is 20“
The fact it was verified computationally that every cube can be solved in at most 20 moves is super impressive and much more complicated than the problem of solving just one cube that we covered in this video!
Four degrees of separation on Facebook
Code:
------------------------
Fill in the gaps:
Convince yourself that the meet in the middle algorithm finds the shortest path!
Convince yourself that the meet in the middle algorithm for Rubik’s cube does not need to know that every cube can be solved in 20 steps.
------------------------
Real Algorithms:
The first algorithms solving a random scramble like Korf’s algorithm
work roughly as follows:
First, although there are around 10^20 possible cube configurations, if you focus on just the possible configurations of 8 corner cubies, the number of possibilities drops to around 10^8. Using breadth first search, you can precompute for each such configuration of corner cubies how many steps you need to put them into the correct position. You need at least that many steps to solve the full cube configuration, probably even more as you need to solve not just the corners but also the edges.
You can now iterate a breadth first search from your scrambled cube, each time looking into further distance from it. For each cube you look up in your table of size 10^8 to find how many steps, at least, are needed to finish the search. If it is more than the current maximum distance you are looking at, you stop searching, as you can be sure you will not find the solved cube in this branch of the breadth first search.
This approach is similar to the meet in the middle algorithm in that we first precompute some information from the solved cube and then run breadth first search from the scrambled cube. However, now you need much less memory.
The actual state of the art algorithms are more complicated than that. You can read more about it e.g. here.
’s_Cube
------------------------
More Connections:
The meet in the middle trick is also called “bidirectional search“ in the context of searching graphs.
Computing the exact number of states of a Rubik’s cube (we used it is around 10^20) is not so hard.
The graphs where the number of nodes in your distance grows exponentially are pretty important in computer science. For example, there are scale-free networks and expander graphs.
Triple DES is kind of a hack made to prolong the life of the DES cipher when it became apparent that it is not strong enough. However, because of the meet in the middle attack, its “security level“ is only 2*56 bits and not 3*56 bits as one would naively expect. But you still need to apply DES three times. So you can guess it is not the most efficient way of doing the encryption; it is now superseded by the so-called AES standard.
------------------------
Riddles:
If you like to solve algorithmic puzzles, here you can find more algorithmic problems that can be solved with this technique:
Try to prove, just with pen, paper and calculator that there is a cube for which at least 16 moves are needed to solve it.
Try to convince yourself that by blind search of the cube graph you cannot beat the sqrt(N) time, at least if you do not use anything else than that the graph “looks random“. Hint: Birthday paradox
------------------------
Attributions:
To make this video, we used manim, a Python library:
The color palette we use:
Photo of Grant Sanderson:
Thumbnail: Alžběta Volhejnová
1 view
5
2
7 years ago 00:02:37 46
The Flashbulb - Algorithmic Piano
4 years ago 00:03:47 58
The Zenith Passage - Algorithmic Salvation
5 years ago 00:04:57 10
Bytebeat: Experimental one-line algorithmic music - the 2nd iteration
10 years ago 00:10:55 26
TEDxConcordia - Yan Ohayon - The Impact of Algorithmic Trading
4 years ago 00:20:54 19
Algorithmic Trading Strategy in Python
4 years ago 00:52:44 20
Houdini Algorithmic Live #071 - Swirling Trail
4 years ago 02:36:38 45
Houdini Algorithmic Live #045 - Mesh Unfolding
4 years ago 01:07:31 12
Houdini Algorithmic Live #080 - Rotary Silhouette
3 years ago 00:54:56 28
Houdini Algorithmic Live #083 - Ring Weaving
4 years ago 01:16:59 24
Houdini Algorithmic Live #058 - Volume Advection
4 years ago 00:07:20 11
Python Algorithmic Trading Course - Introduction
4 years ago 01:15:22 19
Houdini Algorithmic Live #076 - Hard Surfacing
4 years ago 01:51:44 25
Houdini Algorithmic Live #077 - Snake Move
4 years ago 02:25:33 25
Houdini Algorithmic Live #079 - Video Stippling
4 years ago 02:51:26 23
Houdini Algorithmic Live #059 - Swirling Trail
4 years ago 02:43:09 14
Houdini Algorithmic Live #061 - Mushroom Gills
4 years ago 01:24:24 32
Houdini Algorithmic Live #051 - Geodesic Hatching
4 years ago 02:57:27 26
Houdini Algorithmic Live #075 - Recursive Branch Vein
3 years ago 01:30:27 17
Houdini Algorithmic Live #096 - Particle Morphing
5 years ago 01:29:39 17
Houdini Algorithmic Live #026 - Deformed Gyroid
5 years ago 00:02:22 26
Algorithmic Modeling with NX
4 years ago 00:57:26 18
Houdini Algorithmic Live #062 - Kite Tiling Rosette
4 years ago 03:31:33 16
Houdini Algorithmic Live #072 - Text Morphing
5 years ago 00:15:19 10
How To Make Algorithms Fairer | Algorithmic Bias and Fairness