coding180 icon
Coding180

What are the advantages of linked lists over arrays?

Home > Interviews > PHP


robort - 2022-10-03 02:28:00

Linked lists are superior to arrays in the following ways: 

Unlike arrays, which cannot have their size expanded at runtime, linked lists can. 


If contiguous space is not available, nodes can be stored anywhere in memory and connected by a link, allowing a linked list to reside in main memory without having to be contiguous. 


While arrays are statically stored in main memory and their size must be stated at compile time, linked lists are dynamically stored in main memory and increase in response to program needs. 


While the number of elements in an array is constrained by the size of the array, the number of elements in a linked list is constrained by the amount of RAM that is available.


user

Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

Skills
  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel