Toggle navigation
MYNDBOOK
Popular
My Library
Signup for free!
Login
CS246
Homework1
Input
Adjacency list of friends
Name - list of friends
Map to
Each pair of users that aren't friends - list of mutual friends
Final
Need people of highest number of mutual friends
Have
(friend1, nonfriend2) -> mutual friends
New Note
Description
Map input: Name -> List of friends
For each pair of friends, create:
(friend1, friend2) -> 1
Map to
Each pair of possible users
Then map from
(friend1) -> (nonfriend2, # mutual friends)
(friend2) -> (friend1, # mutual friends)
Have
(friend1) -> direct friends
New Note
Description
Reduce
Given friend1, list of mutual friends, sort mutual friends by count
(friend1) -> sorted array of size 10
Reduce
Given friend 1, non friend 2, and list of mutual friends
(friend1, nonfriend2) -> list of mutual friends
Map
Given
(friend1, nonfriend2) -> mutual friend
Login
to remove ads
X
Feedback
|
How-To