11.07.2015 Views

A Deterministic Algorithm for Summarizing Asynchronous Streams ...

A Deterministic Algorithm for Summarizing Asynchronous Streams ...

A Deterministic Algorithm for Summarizing Asynchronous Streams ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Algorithm</strong> 2: Basic Counting: When an element with timestamp t arrives// level 0if there is bucket 〈w(b), t, t〉 ∈ S 0 thenIncrement w(b);elseInsert bucket 〈1, t, t〉 into S 0;end// level i, i > 0<strong>for</strong> i = 1, . . . , M doif there is bucket b = 〈w(b), l(b), r(b)〉 ∈ S i with t ∈ [l(b), r(b)] thenIncrement w(b);if w(b) = 2 i+1 and l(b) ≠ r(b) then// bucket too heavy, split// note that a bucket is not split// if it is responsible <strong>for</strong> only a single time stampNew bucket b 1 = 〈2 i , l(b), l(b)+r(b)+1 − 1〉;2New bucket b 2 = 〈2 i , l(b)+r(b)+1 , r(b)〉;2Delete b from S i;Insert b 1 and b 2 into S i;endendend// handle overflow<strong>for</strong> i = 0, . . . , M doif |S i| > α then// overflowDiscard bucket b ∗ ∈ S i such that r(b ∗ ) = min b∈Si r(b);T i ← r(b ∗ );endend<strong>Algorithm</strong> 3: Basic Counting: Query(w)Input: w, the width of the query window, where w ≤ WOutput: An estimate of the number of elements with timestamps in [c − w, c]where c is the current timeLet l ∈ [0, . . . , M] be the smallest integer such that T l < c − w;return ∑ {b∈S l |l(b)≥c−w} w(b);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!