Linked Lists Data Structures

Published on: 29 Apr. 2025

Category: data structures


Why Linked Lists

While arrays are a great way to store data, they require the programmer to know the size of the array upfront. This is because arrays are stored contiguously in memory. That means the first element of the array is stored at the first memory address. The computer reserves the required amount of memory when the array is created, and when we start storing data, it begins at the start of the reserved memory and continues sequentially from there.

single linked list

But we are programmers—we don’t always know the exact array size ahead of time. Requirements change, and programmers must adapt. So, we invented linked lists. Each item in a linked list has a pointer to the next element. We don’t have to declare the size of a linked list at the beginning because the stored items can be located anywhere in memory. You only have to follow the pointer to the next element.

A Linked List under the hood

Every Linked List it consists of the following properties

Actions of a Linked List