Array vs. Linked List
Array is a static data structure. The length of an array is set when the array is created. After creation, its length is fixed. A linked list is a dynamic data structure. The length (number of nodes in a list) is not fixed and can grow/shrink on demand.
Insertion/deletion to the front or at the middle of an array is expensive; it requires shifting other elements to make/fill a gap. Insertion/deletion in a Linked List can be done as cheap as updating a few reference variables (we will see this soon).
One disadvantage of a linked list is that it does not allow direct access to the individual elements. If you want to access a particular item then you have to start at the head
and follow the references until you get to that item.
Another disadvantage of a linked list is that it uses more memory compared to an array (to store a reference to the next node, for each element).
Resource
- Interviewbit's article on Arrays vs Linked Lists
- Towards Data Science's article on Arrays vs Linked Lists
- A detailed article (with nice visualization) on Array vs Linked List Data Structures from gitconnected.
- Difference between Linked List and Arrays has a nice table for comparison.