Google Interview Question
1,227 Interview Reviews |
Back to all Google Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineering Intern at Google:
how would you find the shortest path between two nodes in a social network?
See more for this Google Software Engineering Intern Interview
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (7)
Helpful Answer?
Yes |
No
Inappropriate?
2 of 2 people found this helpful
To put some example numbers on it, if each person has 100 friends and they are 10 apart, then BFS from one node takes 10^20 operations, whereas BFS from both nodes is 2*100^5= 200 billion operations. BFS from one node is intractable. BFS from both nodes is slow, but tractable.
Helpful Answer?
Yes |
No
Inappropriate?
Helpful Answer?
Yes |
No
Inappropriate?
1 of 1 people found this helpful
If that doesn't make sense, then explain how http://en.wikipedia.org/wiki/Dijkstra's_algorithm#Pseudocode is different from a breadth first search in this case and I will clarify.
Helpful Answer?
Yes |
No
Inappropriate?
Helpful Answer?
Yes |
No
Inappropriate?
Does that make sense?
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up
1 of 2 people found this helpful
by Interview Candidate: