From: Robert Klemme Date: 2005-10-17T03:51:56+09:00 Subject: Re: How to get non-unique elements from an array? Ara.T.Howard wrote: > On Mon, 17 Oct 2005, Robert Klemme wrote: > >> Did you mean to provide this as an example that you actually need to >> count? Because that's what it is: > > no - i meant you have to count - merely note that a element has been > seen and, if so, add it to the list. i notice now my example has a > bug in that an element occuring 4 times is added twice. More precisely speaking: for every even number it's added half that many times because you insert into the Hash and delete and insert and... :-) > it's easy > fix though. i suppose you could call that counting - but's it's > really only 0 or 1, seen or seen again. Yep, like I tried to show with my other example which really knows only three states: not in hash, once in hash, more than once in hash. That's probably the minimalistic set of states that will suffice to solve the problem. Kind regards robert