Take an array a[1000]....input first 1000 values from the stream in it..
Here we are representing a unit time with help of space because 1000
elements in a stream will always come in constant time....

So just count the occurrence of a given number in that array... then divide
the count with 1000 that will be frequency...

For more accuracy just increase the array size upto what accuracy you want
.....



......



On Tue, Sep 27, 2011 at 11:10 PM, teja bala <[email protected]>wrote:

> If we are to find frequency of only one number let us say 35 in infinite
> coming numbers , do xor operation with coming numbers If the result is 0
> increment the value of temp variable by 1 if not scan next input until all
> numbers are over.................
>
>
> On Tue, Sep 27, 2011 at 10:22 PM, Ankuj Gupta <[email protected]> wrote:
>
>> Infinite numbers are coming in a stream .  how will you find the
>> frequency of a given number ?
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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