We can use a trie data structure and treat integers as string.

On Sat, Jul 3, 2010 at 10:33 AM, divya <[email protected]> wrote:
> You are provided with a stream of integers, design a data structure to
> store the number of occurrences of each integer.
>
> If the set of integers is known, then the problem becomes simple.
>
> If the set of integers is known:
> Have a hash of the known set of integers. Parse the input stream, hash
> it to get the key and increase its corresponding value.
>
> how to do efficiently if the set is not known?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Siddharth Prakash Singh
http://www.spsneo.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to