That's not a question, but rather an aggregation post.
So the problem is: how can I achieve O(1) space and O(n) time complexity operating some value-type item (usually integers or chars) list, if I am to find n-times-appearing elements, sort the list or find all unique values?
One little note. This applies only to value-type objects with fixed ranges of values (e.g. integers, chars and so on).
UPDATE
There were lots of questions about using such an approach to achieve O(1) space and O(n) time complexity when sorting or searching for elements that appear k-times, or even number of times, or unique elements or so. So, please read the question carefully, especially the first statement. It's a FAQ-style post, not a question.
Also, I know the answer, no need to post it again and again. If you feel you can add something valuable - feel free to edit the question and the longest answer in the topic (note it's my own answer), so it become a community wiki.
Related questions:
- Finding the first non-repeated character of a string in O(n) using a boolean array?
- Find a single integer that occurs with even frequency in a given array of ints when all others occur odd with frequency
- Find if 2 strings are anagram in O(1) space and O(n) time
- Finding duplicates in O(n) time and O(1) space
- Find duplicates in an array
- O(n) algorithm to find out the element appearing more than n/2 times