Remove duplicate elements: Difference between revisions
→ATS2 implementation for linear values having an equality predicate
Line 656:
=== ATS2 implementation for linear values having an ''equality'' predicate ===
This method runs no worse than O(n*n) in the number of elements. It is another example of the brute-force technique.
This implementation can handle elements of linear type. I implement the predicate as a template function.
There are two interfaces: one for an array, and one for a linked list.
<syntaxhighlight lang="ats">
|