title: How to count distinct values in a list in linear time?
body: <p>I can think of sorting them and then going over each element one by one but this is nlogn. Is there a linear method to count distinct elements in a list?</p>