Algorithms for data stream processing