Home
[This page is auto-generated; please prefer to read the article’s PDF Form.]
[Prev] [Up] [Next] Intact-Rotate Algorithm
void intact_rotate_nonrecur()
{
int I[N-1], s;
for(s = 0; s < N-1; s++)
I[s] = 0;
print();
s = N-2;
while(s >= 0)
{
/* Cleanup Block (for intact()) */
if((N-s)%2 != 0)
SWAP(s, N-1);
if(I[s] < N-s-1)
{
I[s]++;
/* Setup Block (for rotate()) */
if((N-s)%2 == 0)
SWAP(s, N-I[s]);
print();
s = N-2;
}
else
{
I[s] = 0;
s = s-1;
}
}
}
[Prev] [Up] [Next]
Copyright © 2021 Nitin Verma. All rights reserved.