Hello everybody, I'm Aya Bouchiha, on this amazing day, we'll talk about the difference between array and linked list.

## Array VS Linked List

### Array

#### Definition

The array is a collection of elements stored at contiguous memory of a similar data type.

- Array elements are stored in a contiguous block of memory
- fixed size
- accessing directly a specific element
*O(1)* - slow when performing delete and insert operations.
- fast when it comes to finding an element (binary search)

#### Types of Array

- one-dimensional array
- two-dimensional array
- multidimensional array

### Linked List

#### Definition

A linked list is a linear data structure, in which the elements are linked using pointers, additionally, they are not stored at contiguous memory locations. A Linked List consists of Nodes that contain value ( data ) and a pointer to the next node in the chain. The head pointer points to the first node if the list is not empty, and the last element of the list points to null.

- Linked List elements are stored randomly.
- dynamic size
- for accessing an element we need to pass all linked list elements that are preceded by the specified element O(n)
- faster than array when It comes to performing insert and deletes operations.
- take more extra space to store node pointers

for more information about linked lists like the time and space complexity, Linked list's advantages and disadvantages, implementation

#### Types of Linked List

- Singly Linked List
- Doubly Linked List
- Circular Linked List

### References

- https://dev.to/ayabouchiha/linked-list-data-structure-4g7k
- https://www.geeksforgeeks.org/linked-list-vs-array/
- https://techdifferences.com/difference-between-array-and-linked-list.html
- https://www.faceprep.in/data-structures/linked-list-vs-array/
- https://www.studytonight.com/data-structures/linked-list-vs-array
- https://www.javatpoint.com/ds-array-vs-linked-list#:~:text=An%20array%20is%20a%20collection,the%20memory%20or%20randomly%20stored.

## Top comments (0)