Computer Science - Data Structures
Scenario: Social Media Platform Optimization
You're optimizing a social media platform's friend suggestion algorithm. The system needs to: (1) quickly find mutual connections between users, (2) store millions of user relationships efficiently, (3) detect communities and groups, and (4) suggest friends-of-friends. Each operation has an optimal data structure that provides the best time/space complexity for that specific use case.
Categorize each operation by the MOST efficient data structure for the described use case. Drag items into the appropriate category.
Instructions: Drag each operation into the category representing the MOST efficient data structure. You'll be scored on correct categorization (partial credit per category).
Hash Table
Graph (Adjacency List)
Binary Search Tree
Array / List

Operations to Categorize:

Check if two users are directly connected
Find all friends of a user
Detect communities using graph algorithms
Store friend relationships for 10M users
Quick lookup of user profile by username
Maintain sorted list of users by join date
Iterate through all users in order
Find friends-of-friends (2-hop connections)
Cache recently accessed profiles
Store ordered timeline of posts

Scoring Method: Per-Category Accuracy

Categories: Hash Table (3 items), Graph (4 items), BST (1 item), Array (2 items)
Scoring: Points for correct assignments, minus penalties for misclassifications
Per-Category Bonus: Extra points if entire category is perfect
Final Score: (Correct placements / Total items) × 100%