A Singly Linked List (SLL) is a type of linked list where each node contains a data field and a reference to the next node in the sequence. The last node points to null. It is a dynamic data structure, which means it can grow and shrink during runtime.
Basic Operations on Singly Linked List:

This is the representation of SinglyLinkedList.
A linked list is composed of nodes. Each node contains:
First we write the Pseudocode for Singly Linked List Operations
Node Structure
Define Node Structure:
Node:
- data: Integer
- next: NodeWe add a node at the End of the Singly Linked List.
xxxxxxxxxxFunction addNodeAtLast(data: Integer): Create newNode with given data If head is null: head = newNode tail = newNode Else: tail.next = newNode tail = newNodeWe add a node at the begining of the Singly Linked List.
xxxxxxxxxxFunction addNodeAtFirst(data: Integer): Create newNode with given data If head is null: head = newNode Else: newNode.next = head head = newNodeWe add a node at a specific position of the Singly Linked List.
xxxxxxxxxxFunction insertAt(index: Integer, data: Integer): If index is 0: Call addNodeAtFirst(data) Return If index is less than 0 Or index is greater than the length of linked list: Print "Invalid index" Return Create newNode with given data Set current to head Initialize counter j to 0 While j < index - 2: If current.next is null: Print "Invalid index" Return Set current to current.next Increment j Set newNode.next to current.next Set current.next to newNodeCode for Insertions In Singly Linked List
public class OperationsOnSLL{ private static SLLNode sllNodeHead = null; private static SLLNode sllNodeTail = null; // Node structure static class SLLNode { int data; SLLNode next; SLLNode(int data) { this.data = data; this.next = null; } } // Add node at the last of the singly linked list public static void addNodeAtLast(int data) { SLLNode newNode = new SLLNode(data); if(sllNodeHead == null) { sllNodeHead = newNode; sllNodeTail = newNode; } else { sllNodeTail.next = newNode; sllNodeTail = newNode; } } // Add node at the first of the singly linked list public static void addNodeAtFirst(int data) { SLLNode newNode = new SLLNode(data); if(sllNodeHead == null) { sllNodeHead = newNode; } else { newNode.next = sllNodeHead; sllNodeHead = newNode; } } // Insert node at specific index in the singly linked list public static void insertAt(int index, int data) { if(index == 0) { addNodeAtFirst(data); return; } if(index < 0) { System.out.println("Invalid index"); return; } SLLNode newNode = new SLLNode(data); SLLNode current = sllNodeHead; int j = 0; while (j < index - 2) { current = current.next; j++; } newNode.next = current.next; current.next = newNode; } // Print singly linked list public static void printSll(SLLNode sllNodeHead) { SLLNode current = sllNodeHead; while(current != null) { System.out.print(current.data + "->"); current = current.next; } System.out.print("null"); } public static void main(String[] args) { OperationsOnSLL.addNodeAtLast(12); OperationsOnSLL.addNodeAtLast(5); OperationsOnSLL.addNodeAtFirst(4); OperationsOnSLL.insertAt(1, 14); OperationsOnSLL.insertAt(0, 24); printSll(sllNodeHead); System.out.println(); }}24->4->14->12->5->null