From the inventor of Pascal and Modula-2 comes a new version of Niklaus Wirth's classic work, Algorithms Plus Data Structure Equals Programs (PH, l975). This title uses Modula-2 and includes new material on sequential structure, searching and priority search trees.

Hooligan Hooligan Hooligan Hooligan Hooligan 42 Since individual character comparisons now proceed from right to left, the following, slightly modified versions of of the predicates P and Q are more convenient. P(i,j) = Ak: j ≤ k < M : si-j+k = p k Q(i) = Ak: 0 ≤ k < i : ~P(i, 0) These predicates are used in the following formulation of the BM-algorithm to denote the invariant conditions. i := M; j := M; WHILE (j > 0) & (i <= N) DO (* Q(i-M) *) j := M; k := i; WHILE (j > 0) & (s[k-1] = p[j-1])

the relations a2(L+1) = a1(L) a1(L+1) = a1(L) + a2(L) 76 and a1(0) = 1, a2(0) = 0. Defining fi+1 = a1(i), we obtain for i > 0 fi+1 = fi + fi-1, f1 = 1, f0 = 0 These are the recursive rules (or recurrence relations) defining the Fibonacci numbers: f = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... Each Fibonacci number is the sum of its two predecessors. As a consequence, the numbers of initial runs on the two input sequences must be two consecutive Fibonacci numbers in order to make Polyphase work

w in wmrm. Since the computation of stability is a very frequent operation, it is advisable to make this information more directly accessible. To this end, we introduce the two matrices rmw: ARRAY man, woman OF rank; rwm: ARRAY woman, man OF rank 103 such that rmwm,w denotes woman w's rank in the preference list of man m, and rwmw,m denotes the rank of man m in the list of w. It is plain that the values of these auxiliary arrays are constant and can initially be determined from the values of

safeguard is a test pm < m, since we know that all men preceding m are already married. The complete algorithm is shown in module Marriage. Table 3.4 specifies the nine computed stable solutions from input data wmr and mwr given in Table 3.3. PROCEDURE write; (*global writer W*) VAR m: man; rm, rw: INTEGER; BEGIN rm := 0; rw := 0; FOR m := 0 TO n-1 DO Texts.WriteInt(W, x[m], 4); rm := rmw[m, x[m]] + rm; rw := rwm[x[m], m] + rw END ; Texts.WriteInt(W, rm, 8); Texts.WriteInt(W, rw, 4);

quite often, fell in love with my step-daughter and married her. Hence, my father became my son-in-law, and my step-daughter became my mother. Some months later, my wife gave birth to a son, who became the brother-in-law of my father as well as my uncle. The wife of my father, that is my stepdaughter, also had a son. Thereby, I got a brother and at the same time a grandson. My wife is my grandmother, since she is my mother's mother. Hence, I am my wife's husband and at the same time her