KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there an algorithm that, given two sets, computes their intersection in linear time? I can run two for loops to check all pairs of elements, recording elements that I find in both of the sets. However, the runninng time will be O(n 2 ). How do I do this in O(n) time?
Tags (comma-separated)
Save Edits
Cancel