I am in need of best algorithm for a problem.
Problem: There are two arrays array1 and array2 each containing thousand elements. The common elements between both the arrays are to be printed. Please suggest the best algorithm to do this. I would be greatly obliged. Thanks.