you'd never guess it but I've actually
stored a file within this Walmart chip
aisle no it's not stored on my phone or
a flash drive or some other digital
medium but with the actual chip bags
themselves yes this idea is really dumb
but some really interesting math went
into this I went into this idea with one
goal in mind store the string hello
world within the chip aisle of Walmart a
phrase all programmers are far too
familiar with I'll cut to it right now
we store the file by either having a
chip bag facing outward representing a
zero or flipping it round representing a
one it's really simple but theoretically
with enough chip aisles you'd be able to
store any file you want since I wanted
to physically do this the string hello
world has 11 bytes so 88 bits I didn't
want to flip around about 44 bags of
chips so let's compress it this is where
Huffman coating trees come into play
it's a lossless compression algorithm
thought Up by David a Huffman you see he
was a student at MIT in the 1950s
pursuing his Doctorate one of his
professors offered a final exam or an
option to prove an algorithm for
compressing data Huffman was about to
throw in the towel and submit the
studying but then it came to him a
compression algorithm dubbed Huffman
coding this is a tree based compression
algorithm which shortens the length of
common bites and increases the length of
uncommon ones for example for storing
plain text we know e is the most common
character so it will be stored as a
3-bit number whereas a z could be stored
as a 16 bit number since it occurs very
infrequently in text the way we
construct this tree is pretty simple we
count and store the frequency of each
character we then take the two Le least
common characters the ones with the
lowest count and connect them like so we
then take the sum of their frequencies
and treat it as one node we then repeat
this making one big tree in the process
when we finish with a big tree like this
that has used every character we intend
to compress we treat each edge of the
tree as a one or a zero then each
character is represented by the path you
Traverse to get to
it one extremely important aspect to
note about this tree and why it even
works in the first place is that the
compressed version of a character cannot
be the prefix for another which is why
characters do not have any children in
the tree for example if an e was a one
and an a was a one one and we were given
the text
1111 it could mean e e e e a a e AE AE e
or E EA you could probably imagine when
decrypting an entire file this sort of
ambiguity is going to lead to an
impossible conversion anyways let's get
back to the task at hand let's take the
string hello world and construct the
Huffman tree corresponding to it using
this tree we shortened the 88 bits of
hello world stored as normal computer PL
Texs to 32 bits meaning I'll have to
flip about 16 bags of chips a much more
reasonable task than 44 bags so let's do
it the Walmart I go to is always super
busy so as to avoid looking like a
complete lunatic I went at 10:30 30
minutes before closing to avoid the most
suspicion that I could I also tried to
hide my phone as well as I could
so so as to not get asked to leave by
staff for recording made it to Walmart
it's raining out as you can
tell
10:30 hopefully will not arouse any
suspicion or get kicked out so uh I'm a
little nervous but let's do
it we have officially infiltrated
Walmarts but we are hit by the worst
case scenario
possible there is currently a worker
restocking the chips so as to not look
weird I think I will wait a little bit
till they're done
the coast is clear I'm going
start I think I'm going to go on this
layer right here since it has a lot of
uninterrupted chips so I'm going to
start I've officially done it I look so
weird
but that is hello
world I got one weird look I definitely
thought I was a weirdo but it's finished
didn't get us to leave let's go great
success it was a tremendous win I
successfully stored information within
an aisle of Walmart but how big of a
file could I possibly store if I used
every chip aisle of every single Walmart
in America to store a file so I did the
only reasonable thing I could think of
counting exactly how many bags of chips
were on the shelves of this aisle I
counted 128 bags of chips on a Shelf and
there were eight shelves so 1,24 bags of
chips in the aisle there are
4,618 Walmarts in America and assuming
all of them have the same size chip
aisle that means we could store 128
bytes in any given Walmart so we could
get about 0.6 megabytes if we used every
single bag of chips in every single chip
aisle of every Walmart in America or
about
0.4% of a balers gate Brie installation
once again the absolute enormity of our
discs continues to amaze me one idea I
had to store an infinite amount of data
would be to use a singular Pringle scan
my idea is as follows rotate a can of
Pringles in extremely precise amount
then record the percentage the can is
rotated with respect to a full
Revolution then take the decimal and
convert it to a binary number
theoretically if you could get any
Precision you wanted you'd be able to
store any file of any length with one
can of Pringles as you could probably
guess this video is just an April fools
but I hope it gave you some cool insight
into the world of prefix trees it was
really fun to make and I felt super
sneaky secretly recording in Walmart
it's not something I usually do as to
not give any extra work to a Walmart
employee when I successfully completed
the task I flip back all around the
chips back to their normal position
anyways like And subscribe if you enjoy
the video I really appreciate you
sticking around till the end and as
always hope you have a blessed rest of
your day bye