Remove duplicate elements: Difference between revisions

Line 657:
=== ATS2 implementation using a radix sort ===
 
This method runs in O(nw) time, where n is the number of elements n and w is a factor that is constant for a fixed-size integer. The method also sorts the unique elements. It is restricted to element types that have a lexicographic ordering.
 
The implementation is for unsigned integers.
 
Radix sorting can sort an array of elements only into the encoding order of their keys, but that is a common case. Here the only reason to sort at all is to quickly eliminate duplicates.
 
<syntaxhighlight lang="ats">
1,448

edits