<s>
The	O
Tompkins	B-Algorithm
–	I-Algorithm
Paige	I-Algorithm
algorithm	I-Algorithm
is	O
a	O
computer	O
algorithm	O
for	O
generating	O
all	O
permutations	B-Algorithm
of	O
a	O
finite	O
set	O
of	O
objects	O
.	O
</s>
<s>
permutations	B-Algorithm
of	O
the	O
set	O
{	O
1	O
,	O
2	O
,	O
...	O
,	O
n}	O
is	O
given	O
by	O
the	O
following	O
pseudocode	B-Language
:	O
</s>
<s>
In	O
the	O
above	O
pseudocode	B-Language
,	O
the	O
statement	O
"	O
yield	O
P	O
"	O
means	O
to	O
output	O
or	O
record	O
the	O
set	O
of	O
permuted	O
indices	O
P	O
.	O
If	O
the	O
algorithm	O
is	O
implemented	O
correctly	O
,	O
P	O
will	O
be	O
yielded	O
exactly	O
n	O
!	O
</s>
<s>
This	O
algorithm	O
is	O
not	O
the	O
most	O
efficient	O
one	O
among	O
all	O
existing	O
permutation	B-Algorithm
generation	O
methods	O
.	O
</s>
<s>
Not	O
only	O
does	O
it	O
have	O
to	O
keep	O
track	O
of	O
an	O
auxiliary	O
counting	O
array	O
(	O
c	O
)	O
,	O
redundant	O
permutations	B-Algorithm
are	O
also	O
produced	O
and	O
ignored	O
(	O
because	O
P	O
is	O
not	O
yielded	O
after	O
left-rotation	O
if	O
c[i]	O
≥	O
i	O
)	O
in	O
the	O
course	O
of	O
generation	O
.	O
</s>
<s>
For	O
instance	O
,	O
when	O
n	O
=	O
4	O
,	O
the	O
algorithm	O
will	O
first	O
yield	O
P	O
=	O
 [ 1 , 2 , 3 , 4 ] 	O
and	O
then	O
generate	O
the	O
other	O
23	O
permutations	B-Algorithm
in	O
40	O
iterations	O
(	O
i.e.	O
</s>
<s>
in	O
17	O
iterations	O
,	O
there	O
are	O
redundant	O
permutations	B-Algorithm
and	O
P	O
is	O
not	O
yielded	O
)	O
.	O
</s>
