Codeless question: Give an efficient algorithm to determine whether two sets (of size m and n, respectively) are disjoint. — The small set can be sorted in O(m log m) time. We can now do a binary search with each of the n elements in the big set, looking to see if it exists in the small one. The total time will be O((n + m) log m). This is better than sorting the larger array or sorting both sets and going through the list.
G
1.2K
Google Interview
This flashcard deck made by jwasham contains knowledge about google interview. For more details, please follow https://github.com/jwasham/google-interview-university