Nerd For Tech
Published in

Nerd For Tech

Linked List

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store