To check if linked lists are connected


#1

If head pointer of two linked lists are given, what will be the algorithm to check if the given linked lists are connected at some points along their lengths or have one or more common nodes, provided the algorithm to be used must have time complexity of O(n) or better.


#2

The two linked lists merge at the intersection point. Therefore there’s only one intersection point.
For the algorithm, check out : https://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/