ArticleslgStudy

computer science

Streaming algorithm

Streaming algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Streaming algorithm rather than just read about it. In short: In computer science, streaming algorithms process input data streams as a sequence of items, typically making just one pass (or a few passes) through the data. These algorithms are designed to operate with limited memory, generally logarithmic in the size of the stream and/or in the maximum value in the stream, and may also have limited processing time per item.

Key takeaways

  • Streaming algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Streaming algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Streaming algorithm from memory before moving on to harder problems.

Reference excerpt

In computer science, streaming algorithms process input data streams as a sequence of items, typically making just one pass (or a few passes) through the data. These algorithms are designed to operate with limited memory, generally logarithmic in the size of the stream and/or in the maximum value in the stream, and may also have limited processing time per item. As a result of these constraints, streaming algorithms often produce approximate answers based on a summary or "sketch" of the data stream.

History Though streaming algorithms had already been studied by Munro and Paterson as early as 1978, as well as Philippe Flajolet and G. Nigel Martin in 1982/83, the field of streaming algorithms was first formalized and popularized in a 1996 paper by Noga Alon, Yossi Matias, and Mario Szegedy. For this paper, the authors later won the Gödel Prize in 2005 "for their foundational contribution to streaming algorithms." There has since been a large body of work centered around data streaming algorithms that spans a diverse spectrum of computer science fields such as theory, databases, networking, and natural language processing. Semi-streaming algorithms were introduced in 2005 as a relaxation of streaming algorithms for graphs, in which the space allowed is linear in the number of vertices n, but only logarithmic in the number of edges m. This relaxation is still meaningful for dense graphs, and can solve interesting problems (such as connectivity) that are insoluble in o ( n ) {\displaystyle o(n)} space.

Models

Data stream model In the data stream model, some or all of the input is represented as a finite sequence of integers (from some finite domain) which is generally not available for random access, but instead arrives one at a time in a "stream". If the stream has length n and the domain has size m, algorithms are generally constrained to use space that is logarithmic in m and n. They can generally make only some small constant number of passes over the stream, sometimes just one.

Turnstile and cash register models Much of the streaming literature is concerned with computing statistics on frequency distributions that are too large to be stored. For this class of problems, there is a vector a = ( a 1 , … , a n ) {\displaystyle \mathbf {a} =(a_{1},\dots ,a_{n})}

(initialized to the zero vector 0 {\displaystyle \mathbf {0} } ) that has updates presented to it in a stream. The goal of these algorithms is to compute functions of a {\displaystyle \mathbf {a} } using considerably less space than it would take to represent a {\displaystyle \mathbf {a} } precisely. There are two common models for updating such streams, called the "cash register" and "turnstile" models. In the cash register model, each update is of the form ⟨ i , c ⟩ {\displaystyle \langle i,c\rangle } , so that a i {\displaystyle a_{i}} is incremented by some positive integer c {\displaystyle c} . A notable special case is when c = 1 {\displaystyle c=1}

(only unit insertions are permitted). In the turnstile model, each update is of the form ⟨ i , c ⟩ {\displaystyle \langle i,c\rangle } , so that a i {\displaystyle a_{i}} is incremented by some (possibly negative) integer c {\displaystyle c} . In the "strict turnstile" model, no

a i {\displaystyle a_{i}} at any time may be less than zero.

Sliding window model Several papers also consider the "sliding window" model. In this model, the function of interest is computing over a fixed-size window in the stream. As the stream progresses, items from the end of the window are removed from consideration while new items from the stream take their place. Besides the above frequency-based problems, some other types of problems have also been studied. Many graph problems are solved in the setting where the adjacency matrix or the adjacency list of the graph is streamed in some unknown order. There are also some problems that are very dependent on the order of the stream (i.e., asymmetric functions), such as counting the number of inversions in a stream and finding the longest increasing subsequence.

Evaluation

The performance of an algorithm that operates on data streams is measured by three basic factors:

The number of passes the algorithm must make over the stream. The available memory. The running time of the algorithm. These algorithms have many similarities with online algorithms since they both require decisions to be made before all data are available, but they are not identical. Data stream algorithms only have limited memory available but they may be able to defer action until a group of points arrive, while online algorithms are required to take action as soon as each point arrives. If the algorithm is an approximation algorithm then the accuracy of the answer is another key factor. The accuracy is often stated as an ( ϵ , δ ) {\displaystyle (\epsilon ,\delta )} approximation meaning that the algorithm achieves an error of less than ϵ {\displaystyle \epsilon } with probability 1 − δ {\displaystyle 1-\delta } .

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Streaming algorithm

Start with the simplest possible case. Write down what Streaming algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Streaming algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Streaming algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Streaming algorithm

In research
Streaming algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Streaming algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Streaming algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Streaming algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Streaming algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Streaming algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Streaming algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Streaming algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Streaming algorithm in simple terms?

In computer science, streaming algorithms process input data streams as a sequence of items, typically making just one pass (or a few passes) through the data. These algorithms are designed to operate with limited memory, generally logarithmic in the size of the stream and/or in the maximum value i…

Why does Streaming algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Streaming algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Streaming algorithm.

Tags

  • Streaming algorithms

Keep exploring