35-Section-Handout

35-Section-Handout - CS106X Autumn 2010 Handout 35 November...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS106X Handout 35 Autumn 2010 November 29 th , 2010 Section Handout Problem 1: People You May Know Because Facebook is interested in growing out its social graph as much as possible, most users are presented with a list of other users who they think you might be friends with even though that friendship isn’t recorded with Facebook. That list is drawn from the set of Facebook users who are strictly two degrees away from you—that is, the list of your friends’ friends that aren’t already friends with you. Assume that the following node definition is used to represent a Facebook user: struct user { int userID; // unique string name; // not necessarily unique Set<user *> friends; // assume friendship is symmetric }; Write a function called getFriendsOfFriends , which given the address of your node in the social graph, returns as a Set the collection of nodes representing those on Facebook who are two degrees away from you. Set<user *> getFriendsOfFriends(user *loggedinuser);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2011 for the course CS 106X taught by Professor Cain,g during the Fall '08 term at Stanford.

Page1 / 2

35-Section-Handout - CS106X Autumn 2010 Handout 35 November...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online