> For the complete documentation index, see [llms.txt](https://kdongs.gitbook.io/kdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kdongs.gitbook.io/kdocs/data-structures/arrays.md).

# Arrays

## About

The most fundamental idea of an Array is that it is a contiguous memory space.

This space must be informed in it's allocation, and you cannot grow it, only reallocate it to a new bigger or smaller `Array`.

## Getting at specific index

Takes the `width of the type` (Bytes) and you multiply by the `offset` of the position you want.

{% hint style="info" %}
This take $$O(1)$$, since you know the `type width` and the `offset`, you just multiply them.
{% endhint %}

## Inserting at specific index *(Not really inserting)*

The content of the index is overwritten, since you cannot just grow the array size.

{% hint style="info" %}
Also $$O(1)$$, since accessing at specific position is constant.
{% endhint %}

## Deleting at specific index *(Not really deleting)*

Overwrite the content of the index to some specific `null` value. (Not necessarily `null`)

{% hint style="info" %}
Also $$O(1)$$, since it is basically the same as inserting.
{% endhint %}
