{ perm2.txt -- Algorithm #3: Permutation Two by Tom Swan }

procedure Permute(n: Integer);
begin
  pos <- pos + 1;
  a[n] <- pos;
  if pos = MAX then Show array;
  if pos <> MAX then
    for i <- 1 to MAX do
      if a[i] = 0 then Permute(i);
  pos <- pos - 1;
  a[n] <- 0;
end;


(*
// --------------------------------------------------------------
// Copyright (c) 1993 by Tom Swan. All rights reserved
// Revision 1.00    Date: 02/08/1993   Time: 11:20 am
*)
