| Article Index |
|---|
| DeleteDuplicate elements in List |
| Source code |
| Documentation |
| Test cases |
| Compatibility & Reference |
| All Pages |
DELETE DUPLICATE ELEMENTS IN A LIST
Introduction :
Linked lists are used to organize data in specific desired logical order, independent of the memory address each node is assigned to. Linked list data storage works best with data arrays in which one doesn’t know how large the array will need to be or when there is a certainty of more data being added or subtracted at later times.
The aim of this program is to delete the duplicate elements (i.e. the repeating elements) in the list. This can be done by overwriting the node with duplicate element with its next node. Consider the following list with 4 nodes.

In this example, the third node is a duplicate to that of the first which is found out using 2 temporary pointers to the list. When a duplicate element is identified, it is overwritten by its next node. Here, the third node is overwritten by fourth node. So, the list becomes

| < Prev | Next > |
|---|




