Why is it showing error?-intersection of 2 linked list
The logic which you are using to find the intersection point is wrong. Your code will work only if the intersection point element is at the same position in both the lists.
For example -
Your code will work for the lists -
1 2 3 4 5
6 7 3 4
3 is the intersection point here
But your code will not work for the lists -
1 2 3 4 5
6 7 4 5
4 is the intersection point here
but it is a segmentation fault
it should atleast display some reply
No that’s not the point. Your goal is to understand the logic behind the problem and get the correct answer. Just getting any random answer won’t help.
And it shows a segmentation fault in your code which is wrong.
Try to come up with some approach. Tell me if you are able to do so. Otherwise I will help you.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.