What data structure is used to implement facebook like's post and comments? -
this question has answer here:
- facebook “like” data structure 4 answers
this 1 of java interview questions...
i asked data structure use implement facebook post, , comments?
i love hear view of members....
this more task database (notice how complex below is, compared this (because of below taken care of proper database proper indexing)), but...
note i'm assuming posts can liked , comments post.
posts:
posts can a map of post id post object.
if want see list of posts user made, you'll need a map of user id set of post ids.
likes:
you want number of likes per post , see whether user liked post, a map of post id set of user ids of it.
if want see things user likes, you'll need data structure - a map of user id set of post ids liked.
comments:
comments can a map of comment id comment object. connected post id stored in comment object.
you want comments per post, a map of post id set of comment ids.
if want see list of comments made user, you'll need data structure - a map of user id set of comment ids.
Comments
Post a Comment