Linked List

Matthew Clark
Nerd For Tech
Published in
Jun 20, 2022

A linked list is a linear collection of data nodes connected in memory through pointers. Each node has the data value being stored and a pointer or reference to another node. A linked list is created when one node's pointer is pointing at another node.

Unlike arrays or lists, linked list elements are not stored at contiguous memory locations. Pointers or references allow the nodes to be spread out in memory and still be connected in the linked list. This allows you to add or remove list elements without reallocating the entire structure because the elements do not need to be contiguously stored in memory.

The picture above shows a basic definition of the node class. A linked list is simply a collection of these nodes that point to the next node in the string.

--

--