Examples of MOQA Programs
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.
KeywordsPartial Order Binary Tree Selection Phase Random Structure Sorting Algorithm
Unable to display preview. Download preview PDF.