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.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs