Linked Lists
Linked Lists
Linked lists are a common data structure in Computer Science. You can use a linked list to represent a music playlist, or track history of actions, for example.
Linked lists are a common data structure in Computer Science. You can use a linked list to represent a music playlist, or track history of actions, for example.
Overview
A linked list is a linear data structure where each element stores a reference to the next element in the list. Each element in a linked list is called a node. A node is a container that holds some data and a reference to the next node.
Linking different nodes together in a sequence creates a linked list. The first node in the list is called the head node, and the last node is called the tail node. To traverse through the list, you start at the Head and travel to the next element using the reference in each node.

When to use
Linked lists are a good starting point for implementing other data structures such as stacks or queues. Linked lists are a straightforward way of storing data for sequential access, and they support the quick insertion of new elements. Unlike arrays, linked lists are not contiguous (next to each other) in memory. This means that a node could be anywhere in memory, and the reference to the next node tells you the location. To insert or delete nodes from a linked list, all you need to do is change the references to which node comes next.
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.