Annotation of 43BSDReno/pgrm/pascal/tstpx/src/ancestor2.p, revision 1.1.1.1

1.1       root        1: program ancestor2(output);
                      2: {ancestor algorithm using sets instead of boolean matrix}
                      3:   const n = 20;
                      4:   var i,j: integer;
                      5:       r: array [1..n] of set of 1..n;
                      6: begin { j in r[i] = "i is a parent of j"}
                      7:   for i := 1 to n do
                      8:     if i mod 10 <> 0 then r[i] := [i+1] else r[i] := [];
                      9:   writeln(wallclock);
                     10:   for i := 1 to n do
                     11:     for j := 1 to n do
                     12:       if i in r[j] then
                     13:                r[j] := r[i]+r[j];
                     14:   writeln(wallclock);
                     15:   for i := 1 to n do
                     16:   begin write(' ');
                     17:     for j := 1 to n do
                     18:       if j in r[i] then write('1') else write('.');
                     19:     writeln
                     20:   end ;
                     21:   writeln(wallclock)
                     22: end .

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.