话说违法交规时,条子就在附近,如何处理。 (转载)# Joke - 肚皮舞运动
B*1
1 楼
图论比较弱,觉得应该是用图,请大牛们指点:
Suppose there are 2 persons A and B on FB . A should be able to view the
pictures of B only if either A is friend of B or A and B have at least one
common friend . The interviewer discussed it for nearly 30 minutes . The
discussion mainly included following points -
1. How are you going to store the list of friends for a given user ?
2. File system vs DB
3. Given list of friends of 2 users , how are you going to find common
friends ?
4. If you are going to store the friends in DB then how will the table
look like ?
5. How many servers do you need ?
6. How are you going to allocate work to servers ?
7. How many copies of data will you need ?
8. What problems will you face if you are maintaining multiple copies of
data.
Suppose there are 2 persons A and B on FB . A should be able to view the
pictures of B only if either A is friend of B or A and B have at least one
common friend . The interviewer discussed it for nearly 30 minutes . The
discussion mainly included following points -
1. How are you going to store the list of friends for a given user ?
2. File system vs DB
3. Given list of friends of 2 users , how are you going to find common
friends ?
4. If you are going to store the friends in DB then how will the table
look like ?
5. How many servers do you need ?
6. How are you going to allocate work to servers ?
7. How many copies of data will you need ?
8. What problems will you face if you are maintaining multiple copies of
data.