Member-only story

Linked List —Add a node at the end

tarun bhatt
2 min readApr 4, 2020

Some days back, I started reviewing my concepts of Data Structures. It’s often said that the best way to learn is to describe your learning to someone else. This article is a continuation of that initiative. It’s advisable to have a basic understanding of Linked List before reading this article.

In my previous article, I have covered the topic covered by adding a new node at the front of the Linked List.

In this article, I would cover the steps involved in adding a node at the end of the list.

To get a basic understanding of Linked List and Nodes, please read my first article in this series.

Steps involved to add a node at the end are as:

  1. Point the Next object of the Tail to the new node
  2. Point the Tail object of the Linked List to the new node.

We will have to be careful of another couple of points:

  1. If the list is empty, point the Head of the Linked List to the new node.

--

--

tarun bhatt
tarun bhatt

Written by tarun bhatt

Learning to write and share. #ITNerd #MentalHealthAdvocate #MenRightsActivist #ToastMaster #PublicSpeaker

No responses yet