Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: In-Person
What are the data structures holding this information?
I don't think all of these things are in the same graph, because there are different categories of objects here, and they are related "loosely" by "recommendations."
Did they tell you how it's all organized? Or did they want you to think of a way?
"Recommendation" part of the "hop" is usually not a simple edge.
It looks more like a shortest path problem between two nodes in a tree. We may have to make custom data-structures to represent those nodes(products) & mark them as they are visited along with their distances from start. Add the neighbours to a "to be visited" queue and perform the same on them.
I can relate this to a graph's shortest path problem.
- guptasunny158 September 22, 2013book -> movie -> pizza , These could be the nodes of a graphs.
And from book you have to reach at pizza via some shortest path.