Insertion in a Singly Linked List

This explains the algorithm for insertion in the Singly Linked List in Java.

Introduction

In this lesson, we are going to briefly explain some basic operations and implement them using Java code. The three types of insertion strategies used in a Singly Linked List are:

  1. Insert at Head
  2. Insert at End
  3. Insert After

Insertion at Head

This type of insertion means that we want to insert a new element as the first element of the list. As the head always points to the first element of the list, insertion at head means that we are inserting the first element in the list. The following figure shows how InsertAtHead() happens in Singly Linked List:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.