One-pass algorithm


In computing, a one-pass algorithm is a streaming algorithm which reads its input exactly once, in order, without unbounded buffering. A one-pass algorithm generally requires O time and less than O storage, where n is the size of the input.
Basically one-pass algorithm operates as follows:
  1. The object descriptions are processed serially
  2. The first object becomes the cluster representative of the first cluster
  3. Each subsequent object is matched against all cluster representatives existing at its processing time
  4. A given object is assigned to one cluster according to some condition on the matching function
  5. When an object is assigned to a cluster the representative for that cluster is recomputed
  6. If an object fails a certain test it becomes the cluster representative of a new cluster nothing happened

    Example problems solvable by one-pass algorithms

Given any list as an input:
Given a list of numbers:
Given a list of symbols from an alphabet of k symbols, given in advance.
Given any list as an input:
Given a list of numbers: