Mark As Completed Discussion

What is a Linked List?

A linked list is a linear data structure consisting of a group of nodes where each node points to the next node by using a pointer. You can think of a pointer as the address/location of some thing in programming.

Each node is composed of data and a pointer to the next node. See below for the definition of a Node in various languages:

1class Node {
2    constructor(val, next) {
3        this.val = val;
4        this.next = next;
5    }
6}

Here are some quick definitions to make sure we're on the same page:

  • A data structure is a collection of data that can be implemented in any programming language.

  • A pointer stores the address of a value in memory. They can also point to nothing (NULL). A reference is very similar, though they cannot point to nothing.

A linked list can be small or large. Regardless of the size, the elements that make it up are just nodes. Linked lists are just a series of nodes (, which are the elements of the list.

What Is A Linked List?

As shown in the image above, the starting point of the list is a reference to the first node, which is referred to as the head. The last node of the list is often referred to as it's tail. The end of the list isn't a node but rather a node that points to null or an empty value.