BLACK FRIDAY EXTRA SAVINGS EVENT - EXTENDED
START FREE

How much memory does a 32 bit value occupy?

Screen Link:
https://app.dataquest.io/c/86/m/480/space-complexity/6/balancing-time-and-space

The following explanation was given in a screen related to the space complexity lesson.

With 10,000 32bit values, this will already represent about 400MB of memory. With 100,000 32bit values, we need about 38GB of RAM. This is more than most personal computers have.

As per my knowledge,
8 bits = 1 byte. That means a 32bit value occupies 4 bytes.
So 10,000 32 bit values occupies 40,000 bytes ~ 40 KB.
100,000 32 bit values add to 400,000 bytes ~ 0.4 MB

Where am I doing wrong in the calculations?

1 Like

I can understand the confusion here because of how it’s phrased.

They are not saying that 10,000 32-bit values represents 400MB.

With 10,000 32bit values, this will already represent about 400MB of memory.

The this mentioned above, corresponds to the quadratic space complexity - O(V^2 + T)

10,000 32-bit values and a quadratic space complexity will end up taking up about -

\frac{10000*10000*4}{1024*1024} \space \space \text{bytes}

That’s about 400 MB

2 Likes