[NBLUG/talk] Knuth re- revisited

Steve Zimmerman stevetux at sonic.net
Mon May 26 06:29:01 PDT 2003


OK, I'm into him now.  Page 173, vol. 1, Algorithm B.
[Quoting from the text]:

Algorithm B (multiply permutations in cycle form).
This algorithm accomplishes essentially the same result as 
Algorithm A.  Assume that the elements permuted are
named x sub 1, x sub 2,...,x sub n.  We use an auxiliary
table T[1],T[2],...,T[n]; upon termination of this algorithm,
x sub i goes to x sub j under the input permutation
if and only if T[i] = j.

B1. [Initialize.]  Set T[k] <-- k for 1 <= k <= n.

[end of quote]

How would you code B1?   Better yet, how would you
code the entire Algorithm B?
-- 
Steve Zimmerman



More information about the talk mailing list