Bloomberg L.P.

  www.bloomberg.com
  www.bloomberg.com

Interview Question

Financial Software Developer Intern Interview

what is the best way to find the duplicates within two

  intersecting linked list?
Answer

Interview Answer

3 Answers

1

Use a hashtable?

Sissi on Feb 1, 2013
0

Hashtable is unnecessary if the linked list is sorted. Use a modified version of the merge algorithm for merge sort. You can get it in O(n) time without extra work.

Daniel on Feb 7, 2013
1

Well, they didn't want me to use hashtable when I mentioned hashtable. http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/ . What they wanted to hear was the Method 2, where you mark visited nodes.

Mani on Jul 28, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.