tag:blogger.com,1999:blog-6314876008291942531.post5282941076451622787..comments2024-01-14T00:36:43.430-08:00Comments on Antonio Gulli's coding playground: Given a stream of integers compute the average in every instantUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6314876008291942531.post-78774505846287066082012-04-23T12:31:19.832-07:002012-04-23T12:31:19.832-07:00Online algorithm.
sum = 0;
count = 0;
avg = 0;
wh...Online algorithm.<br /><br />sum = 0;<br />count = 0;<br />avg = 0;<br />while( stream not empty )<br />{<br /> sum += next integer;<br /> count += 1;<br /> <br /> avg = sum/count;<br />}<br /><br />Anything that I am missing? :)Anonymoushttps://www.blogger.com/profile/09855100606552890649noreply@blogger.comtag:blogger.com,1999:blog-6314876008291942531.post-89944420535046397522012-03-11T03:01:22.503-07:002012-03-11T03:01:22.503-07:00like http://search.cpan.org/~nids/Statistics-OnLin...like http://search.cpan.org/~nids/Statistics-OnLine-0.02/lib/Statistics/OnLine.pm ?Winstonhttps://www.blogger.com/profile/08229574491730002843noreply@blogger.com