Question: Each user in FaceBooo is defined as a key-value pair where the key is the unique id of the user and the value is an
Each user in FaceBooo is defined as a key-value pair where the key is the unique id of the user and the value is an encrypted pointer to an object that contains data (the wall content) of the user. Most operations in the network involve updating the wall (e.g., a user adds a new picture). Sean knows how to implement these operations efficiently. He also knows how to handle basic operations on keys like become-friend(k1,k2). As Facebooo grows by size, Sean needs to handle a larger variety of queries. For that, he asks your help (after all he is not a computer scientist). The new operations are are-connected(k1,k2) which return true iff the two users are connected (if k1 is a friend of a friend of a friend ... of a friend of k2). FaceBooo also needs to support most-popular-connected(k1) query which returns the user with the maximum number of friends among all users connected to k1. Describe how you support are-connected(k1,k2) and most-popular-connected(k1) operations efficiently. In order to do this, you might need to make changes to your data structure when a user joins the network (join(k1)) as well as when two users become friends (become-friend(k1,k2)). To get the full mark, you need to describe the data as stored in your data structure, and how it is updated/queried in the above four queries. For the sake of simplicity, you can assume users cannot leave the network and cannot unfriend each other in FaceBooo.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
