What is a Linked List? Simple Explanation

Abhinav PandeyAbhinav Pandey
2 min read

What is a Linked List?

A linked list is a way to store data. It’s like a chain of boxes. Each box holds a value and a pointer to the next box.

Think of it like this:
You have a group of friends standing in a line. Each friend knows who is next. That’s how linked lists work. Each item points to the next one.

Why use a linked list?

Sometimes we don’t know how much data we’ll have. Linked lists make adding or removing items easy without moving everything around.

In arrays, we need to decide the size first. But in linked lists, we don’t. We can keep adding new items as needed.

How it works

Each part of a linked list is called a node.
A node has two things:

  • The actual data

  • A pointer to the next node

The first node is called the head.
The last node points to null. That means it’s the end.

Types of linked lists

  1. Singly linked list
    Each node points to the next one. You can only move forward.

  2. Doubly linked list
    Each node points to the next and the previous node. You can move both ways.

  3. Circular linked list
    The last node points back to the head. It loops.

Example (singly linked list):

[10] → [20] → [30] → null

Each bracket is a node.
It holds a value and a pointer to the next.

Common operations

  • Insert: Add a new node

  • Delete: Remove a node

  • Traverse: Go through each node and read the data

When to use it

Use linked lists when:

  • You need to add or remove items often

  • You don’t know the size of data ahead of time

Don’t use it when:

  • You need fast access by index (like in arrays)

That’s the basic idea. It’s simple, flexible, and used in many programs.

0
Subscribe to my newsletter

Read articles from Abhinav Pandey directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhinav Pandey
Abhinav Pandey