How can I tell if there is an intersection?
Two one-way lists, if there are intersections, then their last node must be the same node. We can find the last node of the list, and compare whether they are the same node.
If two linked lists have intersections, how do you determine the position of the intersection?
Each node in a list is compared to each node in another list, and if the same is found, then the same is the intersection point. However, the time complexity of this algorithm is O (MN).
If two linked lists Intersect, then the position of the intersection must be the same as the end of the list (the same linked list is followed). We can align the two lists with the tail end as the starting position. After aligning, compare each node in turn, so that the algorithm complexity is O (m+n).
Whether the unidirectional list has intersections and finds intersections