deshaun_Bergstrom88 answered on March 19th 20 at 08:40
In the General case sorted, go through the list and removes adjacent equal elements.
But maybe it is necessary to solve the problem more radically - instead of list to use a more suitable container - set? In set items are already sorted and unique.
florine84 answered on March 19th 20 at 08:42
Create a collection ensuring uniqueness and add all the values from the list. Get a collection of unique elements. If you output the desired list, cleaning up old or create a new one, then it adds all the unique items from the collection you created.
By the time the work will be O(n * (n - a)), where N is the number of elements in the list, and the number of duplicates. Well, if we very roughly, O(n^2).