DS with JS — Linked Lists

Darshna Rekha
Geek Culture
Published in
6 min readJun 9, 2021

--

Linked list as the name suggests are linked. A linked list can be used for implementing file systems on the computer, browser history, or resolving hash collision.

In this blog, we will be talking about the singly linked list and doubly linked list. We will start with the singly linked list and then extend it to understand the doubly linked list.

Linking My Morning Routine — Made in Excalidraw

Singly Linked List

Linked lists consist of nodes. Each node has two elements, one the value we want to store and a pointer, pointing to the next node or null.

A Node in Singly Linked List

The first node in a linked list is called the head while the last node is called the tail. All linked lists are terminated with a null. Hence the node pointing to null becomes the tail for the linked list.

Singly Linked List — Anatomy

Let us consider a normal morning routine.

const routine = ['make bed', 'brush teeth', 'lemon water'];

The linked list will look like the following.

--

--

Darshna Rekha
Geek Culture

💼 Software Engineer at Cisco Systems, Inc. 🎯 Learn - Code - Repeat 📚 If I am not coding, I am reading