Algorithm

Can anybody please tell me the best algorithm to print the common elements between two arrays which are very large...i just need the algorithm not the code..I don't know anything about C++...so algorithm in C would be preferable..
closed account (z05DSL3A)
This is the third time you have asked the same question, if you want to BUMP a thread fine but please stop repeat posting.

Algorithm:
1.Create a hash table H with capacity with a suitable size.
2.For each element X in array 1, set H[X] to 1.
3.For each element Y in array 2, if Y is in H and H[Z] == 1, return Y.

Algorithm:2
1. Sort array 1.
2. For each element Y in array 2 search array 1, if found return Y.
Last edited on
Thank you very much..and sorry for repeat posting...will see to it that it wont happen again..
Topic archived. No new replies allowed.