Removing Array Duplicates
All solutions here work in place, using the tombstone technique to create a sparse array, then compacting it later. Run time is n lg n, but we require additional space proportional to the input. If we are using a language which allows sorting with closures, we can simplify things by only using an additional array of indices.
Source: flak.tedunangst.com