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 algogeeks@googlegroups.com.
To unsubscribe from this group,
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
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