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
-~----------~----~----~----~------~----~------~--~---
- [algogeeks] Is there any better solution than ... sathiya narayanan
- [algogeeks] Re: Is there any better solut... [EMAIL PROTECTED]
- [algogeeks] Re: Is there any better s... sathiya narayanan
- [algogeeks] Re: Is there any bett... Mohammad Moghimi
- [algogeeks] Re: Is there any ... Nat (Padmanabhan Natarajan)
- [algogeeks] Re: Is there... Mohammad Moghimi
- [algogeeks] Re: Is there any better solut... Atamyrat Hezretguliyew
- [algogeeks] Re: Is there any better s... Mohammad Moghimi
- [algogeeks] Re: Is there any better solut... [EMAIL PROTECTED]
- [algogeeks] Re: Is there any better s... Atamyrat Hezretguliyew