How do you remove duplicates in a large array.
Utilisateur anonyme
If we are allowed to modify the array, we could do an in-place sort, O(n log n), and then a walk-through, deleting the duplicates. This solution would run in O(n log n) time and require constant memory. If the array’s elements can be mapped to unique integers and the largest of these integers is guaranteed to be less than 2^31, then we can use a bit array to store presence, which may require less memory than a hash table.