Tech IndustryJan 20, 2019
Pingercreate💻

Disagreeing with CtCI answers

I've got the 5th edition and just went over the answer for this question: > How would you design the data structures for a very large social network like Facebook or LinkedIn? Describe how you would design an algorithm to show the connection, or path, between two people (e.g., Me -> Bob -> Susan -> Jason -> You). The answer provided is basically distributed BFS, which is fine. But the answer doesn't address at all a) limiting the search to a few degrees of separation or b) doing the BFS in real-time vs pre-computing it. If you do the BFS in real-time when the user is loading someone's profile page, potentially searching millions of nodes, it's too slow. If you pre-compute the paths, then you need to consider how to store them and when to pre-calculate them. Does the answer for this one miss the mark?

Add a comment
Google alumnius Jan 20, 2019

I always assumed this was why LinkedIn limits to 3rd degree connections. Does a bloom filter help here at all?

Pinger create💻 OP Jan 20, 2019

I'll have to read up on bloom filters -- not sure yet 😱

McMaster-Carr GlOn52 Jan 20, 2019

Bloom filters only support insertions no deletions. At least vanilla version.

Microsoft Y33T Jan 20, 2019

Zuck actually delivered a lecture on this and how FB solve, look up CS50 on YouTube

Microsoft 2B|!2B=? Jan 20, 2019

About 5 years ago I emailed the author a list of errors I found in the book. You can reach out to her and she will gladly fix them in the next edition.

Amazon Jan 20, 2019

Ctci is inadequate for system design topics. Look elsewhere

Tableau krxi15 Jan 20, 2019

You know its just speculation from her side right? How Facebook actually does it is way more complicated and proprietary knowledge. What she is proposing and what you are talking about might not be the case of reality at all.

LinkedIn oCKT78 Jan 21, 2019

I also wouldn't expect an interviewee to on the spot design an highly optimized version. But I would expect some discussion of aspects that need to be improved and how might do it.