We provide several examples of well-known algorithms for sorting and searching, programmed in MOQA. Two new sorting algorithms are introduced, Percolating Heapsort and Treapsort, based on the MOQAdeletion operation. Percolating Heapsort provides the first randomness preserving version of Heapsort.
In the following examples Xdenotes the input S-variable while Zdenotes the output S-variable.
We adopt the convention in the presentation thatMOQAalgorithms when called on orders of size 0 or 1 act as the identity operation, i.e. will simply return the datalabeling of a partial order of size 0 or 1.
Moreover, when referring to a call to a basic operation on an S-variable X, we assume implicitly that the data-labeling stored in the variableXis reset to the output data-labeling computed by the basic operation. For instance, we will refer to Top(X) as opposed to [X:= Top(X)] in the pseudo-code.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2008 Springer Science+Business Media, LLC
About this chapter
Cite this chapter
(2008). Examples of MOQA Programs. In: A Modular Calculus for the Average Cost of Data Structuring. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-73384-5_8
Download citation
DOI: https://doi.org/10.1007/978-0-387-73384-5_8
Publisher Name: Springer, Boston, MA
Print ISBN: 978-0-387-73383-8
Online ISBN: 978-0-387-73384-5
eBook Packages: Computer ScienceComputer Science (R0)