Content deleted Content added
Nils Grimsmo (talk | contribs) m removed "compu-stub" |
Nils Grimsmo (talk | contribs) m Removed a section. Minor fixes. |
||
Line 2:
All statements are assignments, and are separated by <code>#</code>. A statement can consist of multiple assignments, on the form <code>a,b,c := x,y,z</code>, or <code>a := x || b := y || c := z</code>. You can also have a ''quantified statement list'', for example <code><# x,y : 0 < x < y < n :: ''statement''></code>, where x and y are chosen randomly among the values that satisfy the quantification. A ''quantified assignment'' is similar. In <code><|| x,y : 0 < x < y < n :: ''statement'' ><code>, the statement is executed simultaneously for ''all'' <code>x</code> and <code>y</code> satisfying <code>0 > x > y < n</code>.
==Examples==
===Insertionsort===
[[Insertion sort]] the array by comparing adjacent numbers, and swapping them if they are in the wrong order. Using <math>\Theta(n)</math> time
Program sort2
Line 40 ⟶ 25:
===Mergesort===
[[Merge sort]] the array using a constant time merge. Using <math>\Theta(\log n)</math> time
Program sort3
|