top of page

Data structures from scratch- Bot-up series #4[Prerequisites for data structures]

Before diving deep into Data structures, we must have a clear understanding of ‘memory’ in computer

The computer has memory and storage Storage =Parmanent(i.e app we use like chrome,photoshop etc) Memory=Temporary(i.e Whatever program or code we run will make use of this)

In computer, this Memory is called Random Access Memory(RAM)


Let’s say a room has 1000 closed shelves arranged vertically Shelves are closed by the door. If I connect ropes to the first 400 doors out of 1000 doors, I can easily open them standing on the floor with the help of a rope. The first 400 doors are RAM and the rest 600 doors are storage My hands are ‘Memory Controller’ and ropes are basically ‘wires’(Directly connected)

Why Random and Access? I can open any door with the rope ‘Randomly’ and ‘Access’ the content

We will number each shelf(say 1,2,3…etc). We call each shelf’s number its address. Shelves can contain anything(In the computer world it is ‘Data’)

We know that computers take data as binaries(0 and 1) Essentially this means I have only 0 and 1 to fill available space. Each shelf has eight available places to fill with 0 and 1.

Here places = bit(binary digit) which can hold either 0 or 1 8 places = 8 bits = 1 byte

Why 8 bits? Because to store a single character like ‘A’,’a’ etc, we need atleast 8 bits or 8 places according to ASCII encoding. Fact:4 bits = 1 nibble = minimum to encode numeric digit(0–9)

So at the max,one byte can represent 255(If all places are 11111111) because 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255(2⁸ -1)

Isn’t it limiting? Then comes the 32-bit system →No matter what your number is it allocates 32 bit.

32 bit ->Max value is 2,147,483,647(2³² -1) Note: Here for even “0” it allocates 32 bit

What if it is more than 2,147,483,647(Approx 200 crores) Then comes 64 bit ->Max value is more than billion’s billion(2⁶⁴ -1)

Nowadays we use 64 bit →No matter what the value is it allocates 64 bit

That’s why when you download java or python or any language it asks whether your system is 32 bit or 64 bit

Stay tuned for the next part — The prerequisites for data structures part II

Recent Posts

See All

As there are many programming languages, there are many programming paradigms. Programming paradigm = style of programming = set of guidelines to solve the problem. So, many programming languages evol

bottom of page