Debian Codegraph @

answers/hi10.out

raw
1
2 /* Pre: sorted(b). */
3 i=1; p=1;
4 while (i != N)
5 {
6 /* Invariant: sorted(b) and 1<=i<=N and */
7 /* p is len of longest run in b[1..i]. */
8 i++; if (b[i] != b[i-p]) p++;
9 }
10 /* Post: sorted(b) and p is the length of the longest run in b[1..N]. */
11
12
13 bool comp(p,q)
14 char *p,*q;
15 {
16 while (TRUE)
17 {
18 if (*p != *q ) return FALSE;
19 if (*p == '\0') return TRUE;
20 p++; q++;
21 }
22 }
23