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

Array

Definition

The array is a collection of elements stored at contiguous me…


This content originally appeared on DEV Community and was authored by Aya Bouchiha

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


This content originally appeared on DEV Community and was authored by Aya Bouchiha


Print Share Comment Cite Upload Translate Updates
APA

Aya Bouchiha | Sciencx (2021-09-07T22:18:02+00:00) Linked List VS Array. Retrieved from https://www.scien.cx/2021/09/07/linked-list-vs-array/

MLA
" » Linked List VS Array." Aya Bouchiha | Sciencx - Tuesday September 7, 2021, https://www.scien.cx/2021/09/07/linked-list-vs-array/
HARVARD
Aya Bouchiha | Sciencx Tuesday September 7, 2021 » Linked List VS Array., viewed ,<https://www.scien.cx/2021/09/07/linked-list-vs-array/>
VANCOUVER
Aya Bouchiha | Sciencx - » Linked List VS Array. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/07/linked-list-vs-array/
CHICAGO
" » Linked List VS Array." Aya Bouchiha | Sciencx - Accessed . https://www.scien.cx/2021/09/07/linked-list-vs-array/
IEEE
" » Linked List VS Array." Aya Bouchiha | Sciencx [Online]. Available: https://www.scien.cx/2021/09/07/linked-list-vs-array/. [Accessed: ]
rf:citation
» Linked List VS Array | Aya Bouchiha | Sciencx | https://www.scien.cx/2021/09/07/linked-list-vs-array/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.