Friend finder
This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are:
- to build your skill applying computational thinking to a problem
- to assess your knowledge and skills of different programming practices
What is this problem set trying to do[edit]
This problem set is helping you learn pseudocode and think computationally.
The Problem[edit]
- A one dimensional array exists with the interests. The interests are stored in an array.
- A two dimension array exists with a userid and the interests associated with that userid.
- In the code sample below, we can see that user id 1 is interested in 2,5,3, and 4. User id 2 is interested in 6 and 7.
- We make an assumption that if two people are interested in the same thing, they might have a higher chance of becoming friends than if they didn't share interests.
interests = ["basketball","dancing","video games","crafts","music","eating","cooking","hanging out","football"]
people_and_their_interests = [[1,[2,5,3,4]],[2,[6,7]],[3,[8,0,2]],[4,[3,7,8]],[5,[7,4,8]],[6,[3,5,7,8]]]
- Construct a pseudocode algorithm which will find friend matches based on similar interest.
Unit Tests[edit]
- Input: the arrays interests and people_and_their_interests
- Expected output:
- user 1 could be friends with user(s): 3,6
- user 2 could be friends with user(s): 4,5,6
- user 3 could be friends with user(s): 4,5,6
- (etc) for all the users
Hacker Version[edit]
Please add output which shows interests and userid. For example,
- basketball: 3
- dancing:
- video games: 1,3
- crafts: 1,4,6
- (etc...)
How you will be assessed[edit]
Your solution will be graded using the following axis:
Scope
- To what extent does your code implement the features required by our specification?
- To what extent is there evidence of effort?
Correctness
- To what extent did your code meet specifications?
- To what extent did your code meet unit tests?
- To what extent is your code free of bugs?
Design
- To what extent is your code written well (i.e. clearly, efficiently, elegantly, and/or logically)?
- To what extent is your code eliminating repetition?
- To what extent is your code using functions appropriately?
Style
- To what extent is your code readable?
- To what extent is your code commented?
- To what extent are your variables well named?
- To what extent do you adhere to style guide?
References[edit]
A possible solution[edit]
Click the expand link to see one possible solution, but NOT before you have tried and failed!
not yet!