One-pass algorithm: Difference between revisions

Content deleted Content added
Adding short description: "Type of streaming algorithm" (Shortdesc helper)
OAbot (talk | contribs)
m Open access bot: url-access=subscription updated in citation with #oabot.
 
(21 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|Type of streaming algorithm}}
<!-- Please do not remove or change this AfD message until the discussion has been closed. -->
{{Article for deletion/dated|page=One-pass algorithm|timestamp=20210413054929|year=2021|month=April|day=13|substed=yes|help=off}}
<!-- Once discussion is closed, please place on talk page: {{Old AfD multi|page=One-pass algorithm|date=13 April 2021|result='''keep'''}} -->
<!-- End of AfD message, feel free to edit beyond this point -->
{{Refimprove|date=April 2021}}
 
In computing, a '''one-pass algorithm''' or '''single-pass algorithm''' is a [[streaming algorithm]] which reads its input exactly once,.<ref name="frankfurt"/> It does so by processing items in order, without unbounded [[Buffer (computer science)|buffering]]; it reads a block into an [[input buffer]], processes it, and moves the result into an output buffer for each step in the process.<ref name="sjsu"/> A one-pass algorithm generally requires ''O''(''n'') (see [[Big O Notation|'big O' notation]]) time and less than ''O''(''n'') storage (typically ''O''(1)), where ''n'' is the size of the input.<ref>{{Citation|last=Schweikardt|first=Nicole|title=One-Pass Algorithm|datename=2009|url=https:"eds"//doi.org/10.1007/978-0-387-39940-9_253|work=Encyclopedia> An example of Databasea Systems|pages=1948–1949|editorone-last=LIU|editor-first=LING|place=Boston,pass MA|publisher=Springeralgorithm US|language=en|doi=10.1007/978-0-387-39940-9_253|isbn=978-0-387-39940-9|access-date=2021-04-13|editor2-last=ÖZSU|editor2-first=Mis the Sondik [[partially observable Markov decision process]].<ref TAMER}}<name="pomdp"/ref>
 
Basically one-pass algorithm operates as follows:
# The object descriptions are processed serially
# The first object becomes the cluster representative of the first cluster
# Each subsequent object is matched against all cluster representatives existing at its processing time
# A given object is assigned to one cluster (or more if overlap is allowed) according to some condition on the matching function
# When an object is assigned to a cluster the representative for that cluster is recomputed
# 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==
Line 22 ⟶ 10:
Given a list of numbers:
* Find the ''k'' largest or smallest elements, ''k'' given in advance.
* Find the [[summation|sum]], [[mean]], [[variance]] and [[standard deviation]] of the elements of the list. See also [[Algorithms_for_calculating_varianceAlgorithms for calculating variance]].
 
Given a list of symbols from an alphabet of ''k'' symbols, given in advance.
* Count the number of times each symbol appears in the input.
* Find the most or least frequent elements.
* Sort the list according to some order on the symbols (possible since the and after number of symbols is limited).
* Find the maximum gap between two appearances of a given symbol.
 
Line 33 ⟶ 21:
Given any list as an input:
* Find the ''n''th element from the end (or report that the list has fewer than ''n'' elements).
* Find the middle element of the list. However, this is solvable with two passes: Pass 1 counts the elements and pass 2 picks out the middle one.
 
Given a list of numbers:
Line 39 ⟶ 27:
* Find the [[mode (statistics)|modes]] (This is not the same as finding the most frequent symbol from a limited alphabet).
* Sort the list.
* Count the number of items greater than or less than the [[mean]]. However, this can be done in constant memory with two passes: Pass 1 finds the average and pass 2 does the counting.
 
The two-pass algorithms above are still [[streaming algorithm|streaming algorithms]] but not one-pass algorithms.
 
== References==
<references/>
<ref name="eds">{{Citation|last=Schweikardt|first=Nicole|title=One-Pass Algorithm|date=2009|url=https://doi.org/10.1007/978-0-387-39940-9_253|encyclopedia=Encyclopedia of Database Systems|pages=1948–1949|editor-last=LIU|editor-first=LING|editor-link=Ling Liu (computer scientist)|place=Boston, MA|publisher=Springer US|language=en|doi=10.1007/978-0-387-39940-9_253|isbn=978-0-387-39940-9|access-date=2021-04-13|editor2-last=ÖZSU|editor2-first=M. TAMER|url-access=subscription}}</ref>
<ref name="frankfurt">{{Cite web|last=Schweikardt|first=Nicole|title=One-Pass Algorithm|url=http://www.tks.informatik.uni-frankfurt.de/schweika/downloads/EncycDBS_OnePassAlgos.pdf|access-date=2021-07-01}}</ref>
<ref name="sjsu">{{Cite web|last=Pollett|first=Chris|date=2005-03-14|title=One and Two Pass Algorithms|url=http://www.cs.sjsu.edu/faculty/pollett/157b.12.05s/Lec14032005.pdf|access-date=2021-07-01}}</ref>
<ref name="pomdp">{{Cite web|url=http://www.pomdp.org/tutorial/sondik.html|title=Sondik's One-Pass Algorithm|website=www.pomdp.org}}</ref>
</references>
 
{{cs-stub}}
{{Data structures and algorithms}}
 
{{DEFAULTSORT:One-Pass Algorithm}}