Given: 2 Arrays of N and M numbers in size.
We have to find how many common numbers are available ?

Eg: A={8,5,4,2,9}
      B={1,2,3,4,6)

Solution is:2
Common elements are {2,4}

What i wll do is Sort the array A and then do the binary search for each
element in array B.So the complexity wll be 0(nlgn)

Any idea to do better than 0(nlgn) ?

PS: If it is a repeating question,then give me the link,where can i find the solution.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to