Find a extra node in two linked list

Given two linked list of integer elements, Which is contain similar elements with one different node. Our goal is to detect this extra node which are exist in given linked list. Note that given linked list elements are not sorted, So that way linked list node occurrence can be different to other linked list. For example.

Example 1
Linked List A :  1  2  4
Linked List B :  4  2  3  1
Result :  3 //Node 3 are extra node
[Explain : node 3 not exists in Linked List A]

Example 2
Linked List A :  -8 5  5  2  7
Linked List B :   2 5  5  7
Result :  -8 //Node 3 are extra node
[Explain : node -8 not exists in Linked List B]

Here given code implementation process.



Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved