DEV Community

Cover image for Just an array???
Sakshi
Sakshi

Posted on

1

Just an array???

In this post, we'll not see syntax, code and any algorithm.

It is just you and these arrays.

Ok, so we know how to store individual numbers. Let's talk about storing several numbers.

What is array?

RAM is basically an array already.

It is a linear data structure, stores elements in contigous manner.

Each item in the array is the same size (takes up the same number of bytes).
The array is uninterrupted (contiguous) in memory. There can't be any gaps in the array...like to "skip over" a memory slot Spotify was already using.

address of nth item in array=

address of array start + (n∗size of each item in bytes)

Arrays have fast lookups (O(1) time), but each item in the array needs to be the same size, and you need a big block of uninterrupted free memory to store the array.

Thanks for reading
In this blog we were only discussing what exactly the array is, thatswhy not included its types, syntax and drawbacks.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay