> For the complete documentation index, see [llms.txt](https://dsa.mircea.codes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dsa.mircea.codes/dsa-1-array-uri.md).

# DSA 1: Array-uri

## Structuri de Date: Array

### Definitie

Array-urile (vectori plm) sunt un aranjament de obiecte de acelasi fel dispuse intr-o linie.

Un array stocheaza mai multe date de acelasi tip in locatii adiacente/alaturate in memorie, astfel incat a.i fiecare element si pozitia lui sunt usor de accesat individual.

Un array este format din elemente, care reprezinta valori, unde fiecare element are un index (pozitie) unic.

<figure><img src="/files/e6Q3xhxjJNyKi0RPf5cx" alt=""><figcaption><p>structura array-ului</p></figcaption></figure>

{% hint style="info" %}
Este important de tinut minte ca elementele sunt stocate **unul dupa altul** in memorie!
{% endhint %}

Folosind array-uri putem construi de asemenea array-uri multidimensionale, formand astfel matrici de mai multe feluri.

Desi ele sunt folosite ca si cum ar fi n-dimensionale, ele sunt tot unidimensionale in memorie. Exemplu:

<figure><img src="/files/KEelr9MtxVadpWtT4aVF" alt=""><figcaption><p>array multidimensional</p></figcaption></figure>

Matricea din imagine este formata din 3 array-uri unidimensionale, pe care le vom numi randuri:

Array 1: `[3, 2, 7]`\
Array 2: `[2, 6, 8]`\
Array 3: `[5, 1, 9]`

Care sunt si ele la randul lor elemente ale unui alta array, array-ul pe care il numim matrice:

Array matrice: `[[3, 2, 7], [2, 6, 8], [5, 1, 9]]`

Asa obtinem un array bidimensional. Daca vrem un array tridimensional, putem face alte 3 astfel de matrici ca cea de sus, pe care sa le stocam in alt array.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dsa.mircea.codes/dsa-1-array-uri.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
