DEV Community

Aya Bouchiha
Aya Bouchiha

Posted on • Updated on

Linked List VS Array

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



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


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


Top comments (0)