let a[] represent an arbitrary list of objects to permute
let N equal the length of a[]
create an integer array p[] of size N+1 to control the iteration
initialize p[0] to 0, p[1] to 1, p[2] to 2, ..., p[N] to N
initialize index variable i to 1
while (i < N) do {
decrement p[i] by 1
let j = 0
if i is odd, then let j = p[i]
swap(a[j], a[i])
let i = 1
while (p[i] is equal to 0) do {
let p[i] = i
increment i by 1
} // end while (p[i] is equal to 0)
} // end while (i < N)
