Original Post
I have an array of numbers, say: 1,2,3,7,7,7,8,9,9. From this array I want to make another array containing only the unique numbers (no duplicates), like so: 1,2,3,7,8,9. Simple, do something like this: for each number in array1 if not number exists in array2 then add number to array2 The problem is that I want it to be fairly fast and because of the array is huge looping through array2 to check if a number already exists gets slow. So I was thinking of sorting the arrays and do a binary search. Or is there some other clever way?