|
interview_questions
|
|
|
|
|
Bookmarks
|
|
|
|
|
|
| |
1. For i=0 to A.length
2. If (Find(B, A[i]) == True)
3. Intersection.add(A[i])
4. Return Intersection
comment by sachidanand on 2009-09-29 09:50:26
|
Sort the two arrays in O(NlogN).Then find the intersection in O(N)
comment by imrankane2005 on 2009-12-27 10:13:03
|
I think we sorting one array of smaller size is enough. Then just traverse bigger array and find the number in smallery array using binary search.
comment by aravinds03 on 2010-09-25 15:21:58
|
|
|