Member-only story
Linked List —Add a node at the end
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:
- Point the Next object of the Tail to the new node
- Point the Tail object of the Linked List to the new node.
We will have to be careful of another couple of points:
- If the list is empty, point the Head of the Linked List to the new node.