Originally posted by Bala Krishna:
I was asked this question recently in an interview. The interviewer wanted to know how to get the intersection of two unsorted arrays. My answer was to use the bruteforce approach  for each element in one array, check if the element exists in the second array by looping thru it. He asked for a better approach, and my answer was to construct a binary search tree using the first array and do a look up with the elements in the second array. He didn't seem satisfied. Are there any better ways of doing this? TIA.
"I'm not back."  Bill Harding, Twister
"I'm not back."  Bill Harding, Twister
Originally posted by Jason Liao:
The complexity of sorting algorithm is O(mLOG(m)), not O(LOG(m)!!!
O(n) to check the contents of the second
"I'm not back."  Bill Harding, Twister
"I'm not back."  Bill Harding, Twister
There are only two hard things in computer science: cache invalidation, naming things, and offbyone errors
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
