Data structures are a core concept in computer science, and knowing how to identify and utilize each system correctly is the difference between an engineer and a developer. Today I'll be comparing arrays and linked lists, two prevalent data structures.
Similarities
- orders items sequentially
- flexible size (if array is dynamic)
Differences
- arrays store items next to each other in memory while linked lists items aren't
- static arrays aren't flexible in size like linked lists are
- arrays are better for looking up items then linked lists are
- It's easier to perform operations on the ends of linked lists than it is on arrays
Top comments (1)
A more crucial difference is that linked lists can share structure, and this allows for efficient immutable structures.
You can think of a linked list as a tree branch, seen starting from a leaf and proceeding toward the root.