Remove duplicate element from sorted Linked List

Remove duplicate element from sorted Linked List

Write a program which takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list.

The list should only be traversed once.

Algorithm:

  • Iterate list from start to end
  • Update each node next with node that is not equal to current node data

Latest Source Code:
Github: ListDuplicateRemover.java


Output:

1 2 2 2 3 3 4 5 6 
1 2 3 4 5 6 
Author: Hrishikesh Mishra