Algorithm to find no. of duplicate nodes in single link list
Answers
Answered by
0
Answer:
Create a new node.
It first checks, whether the head is equal to null which means the list is empty.
If the list is empty, both head and tail will point to a newly added node.
If the list is not empty, the new node will be added to end of the list such that tail's next will point to a newly added node.
Answered by
0
Explanation:
Input the elements of the linked list in sorted order. Traverse from the head of the sorted linked list. While traversing, compare the current node with the next node. If data of the next node is the same as the current node then delete the next node
Similar questions
English,
26 days ago
Math,
26 days ago
Hindi,
26 days ago
English,
1 month ago
Math,
9 months ago
Social Sciences,
9 months ago
Computer Science,
9 months ago