In this Data structures tutorial we will learn what is Singly LinkedList in java with example and program. We will learn how to implement your own Singly LinkedList in java. We will learn how to delete specific nodes from Singly LinkedList in java. We will also learn complexity of deleting specific nodes from Singly LinkedList in java.

Below implementation of Singly LinkedList helps us in deleting specific node from Singly LinkedList in java.

What is complexity of deleting specific nodes from Singly LinkedList in java?
Complexity of deleting specific nodes from Singly LinkedList is O(n).

Important methods used in below Singly LinkedList program/example are as follows>
deleteSpecificNode(int data)- Method deletes specified Node from Singly LinkedList in java.

Logic explanation of deleting specific nodes from Singly LinkedList in java with diagram >

Let’s see how we are going delete specific node from Singly LinkedList in java:-
Here as soon as we detect that current is the node to be deleted we make
>previous node’s next point to current’s next, doing so makes node pointed by current eligible for garbage collection.

Full Program/Example of deleting specific nodes from Singly LinkedList in java>

Complexity of deleting specific nodes from Singly LinkedList in java -
Best Case :    O(1), when node to be deleted is at first of Singly LinkedList in java.
Average Case :  O(n)
Worst Case : O(n)

In this Data structures tutorial we learned what is Singly LinkedList in java with example and program. We learned how to implement your own Singly LinkedList in java. We learned how to delete specific nodes from Singly LinkedList in java. We also learned complexity of deleting specific nodes from Singly LinkedList in java.

Having any doubt? or you you liked the tutorial! Please comment in below section.

1) Stacks, Queues in Data Structures in java

2) Single LinkedList implementations in Data Structures in java:-

3) Doubly LinkedList implementations in Data Structures in java:-

5) Some of the tricky and interesting Single LinkedList implementations in Data Structures in java

6) Binary tree tutorial in java >