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
11 months ago 00:03:39 1
Genshin Impact Song: ONE MORE PULL (Animation) ■ feat. Black Gryph0n & Rustage
11 months ago 00:13:28 2
Meris MercuryX Modular Reverb System
11 months ago 00:19:28 7
D16 Drumazon 2 (No Talking)
11 months ago 00:04:19 1
Command Z
11 months ago 00:00:23 1
Eureka! Extreme Robot Dexterity with LLMs | NVIDIA Research Paper
11 months ago 00:10:53 1
🤩 русский асмр! 🙂 (шведская девушка пытается бегло говорить по-русски!) (ASMR in Russian!)
11 months ago 00:02:58 1
Route 66 - Beegie Adair Transcription
11 months ago 00:14:45 1
Woodturning an Oak Branch Burl
11 months ago 00:14:43 1
Secure Login System in Python
11 months ago 00:08:45 1
1000 hours of bow makes you a BEAST! (Hunt: Showdown)
11 months ago 00:37:45 1
Filter - Live in Mechanicsburg, PA 5/30/23
11 months ago 00:00:57 5
BattleHood Snippet | Skyverse Industry V2 OST
11 months ago 00:59:58 1
Limp Bizkit - Full Concert | Aftershock 2023 | Live | Discovery Park | Sacramento Ca 10/6/23
11 months ago 00:56:16 1
Finntroll - - Montreal, Canada - Full Set (Best Finntroll show)
11 months ago 00:41:29 1
Seattle 6AM Morning Snow Walk, Downtown to Space Needle
11 months ago 00:05:14 1
Love Theme from Romeo and Juliet - Joslin - Henri Mancini, Nino Rota
11 months ago 00:00:46 1
Claire Gerhardstein in 4K (135)
11 months ago 00:01:41 1
🤖 RISE OF E L L A 🚀 (Official Trailer)
11 months ago 00:15:35 1
Toned Arms Workout | 15 min Upper Body Burn
11 months ago 00:11:07 1
6 Pack Abs Workout | 3 Weeks Challenge
11 months ago 00:11:08 1
Get Toned Abs - 10 Min Workout | Get Toned Challenge
11 months ago 00:00:52 1
A-Train status
11 months ago 00:02:46 1
4k AI Art Lookbook Video | AI Girl | Arab Girl with Eiffel Tower