Ideas:
First, a fast and slow pointer is used to determine whether a chain list exists.
(1) If there is no ring, then if the two linked lists intersect with a common node, that is, from a node, their next point points to the same node. So we judge whether the two linked lists intersect, as long as the two linked lists are traversed to the end respectively. If the two end nodes are the same, they intersect; otherwise, two lists do not want to be handed in.
Link lists intersect, how to find the first intersection node. First, the two lists are traversed once, the length of the two lists is l1,l2, and then the length difference of the two linked list L is obtained. Then the long list is now traversed by the L nodes, and then synchronously traversed, so the first common node in the traversal process is the first one. The time complexity of this method is O (L1+L2).
(2) If one exists ring and the other does not exist, then the two lists are disjoint.
(3) If there is a ring, then judge any one of the list of fast and slow pointer encounters the node, on the other linked list. If in, then intersect, if not, then not intersect.