Bloomberg interview question

Describe an algorithm to find mutual friends on Facebook.

Interview Answer

Anonymous

25 Apr 2011

Say you want to find mutual friends for A and B. Perform a BFS at A and enter all nodes into a hashtable. Similarly perform a BFS at B and find the collisions

1