What Are Linked Lists?

What is a linked list?

A linked list is a linear data structure where each element is a separate object. Each element is called a node and has two main items: its data and a tail (i.e. a reference to the next node). So a list will go from tail to tail until, eventually, we reach a null value and know we’ve reached the end.

A linked list is a dynamic data structure. The number of nodes in a list is not fixed and can grow and shrink on demand. Any application which has to deal with an unknown number of objects will need to use a linked list.

One disadvantage of a linked list against an array is that it does not allow direct access to the individual elements. If you want to access a particular item then you have to start at the head and follow the references until you get to that item.

linkedlists

Types Of Linked List

There are mainly (although not only) two different types of linked list

In a doubly-linked list, the head points to the previous node and the tail points to the next node. With this, we can traverse the list in both directions.

linkedlists


Evan Smith

Evan's a 3rd Year Computer Science Student and the current Auditor of UCC's Networking, Technology and Gaming society. With the dream of educating the world in his wallet, he aims to help everyone learn how to develop, maintain and invent systems.