find common elements in two arrays
Solution 1:
if not sorted, sorted arrays first , use two pointers to point to each array, 谁小移谁
Solution 2 : ( for one array size <<<< another array size)
use hash table to store the smaller table's <element, count> pair. Loop through the bigger array, for each element if contains in the hash table and count > = 1, add to result.
Solution 3: (for one array size <<<< another array size)
binary search , for each element (as target) from smaller array, run binary search against the bigger array.
( if duplicate element included in the result, actually this solution is not easy implemented )