Algorithm: efficient way to remove duplicate integers from an array

A solution suggested by my girlfriend is a variation of merge sort. The only modification is that during the merge step, just disregard duplicated values. This solution would be as well O(n log n). In this approach, the sorting/duplication removal are combined together. However, I’m not sure if that makes any difference, though.

Leave a Comment