Microsoft Interview Question

Find a convergence point if any in given two linked lists.

Interview Answers

Anonymous

Oct 7, 2011

Just traverse through both the lists once, say m and n are the length of the lists, get abs(m-n) say k, traverse k nodes in the bigger list, then keep on traversing one by one in both lists till a node matches. The first node that matches is the convergence point.

1

Anonymous

Dec 10, 2011

A faster approach is to store all elements of one list in a hashtable, then traverse the other list checking each node to see if it exists in the hashtable - if it does, you've got the convergence point.

1