**Overview:**
I am trying to implement the Johnson Trotter Algorithm in
Java so that I can solve a problem on
Project Euler. I have looked and looked but as far as I can see I have everything implemented right, which you know is wrong, otherwise I wouldn't be asking this question
The basic algorithm goes like this:
I have created an `Element` object that has attributes
to use for this algorithm. When I am swapping values, only one swap occurs, then after that the original order is printed over and over.
**Code:**
**Expectations:**
I would expect the algorithm to do something like this
Start:
<0 <1 <2
<0 <2 <1
<2 <0 <1
etc
**Actual**
This is what it actually does
Start:
<0 <1 <2
<0 <2 <1
<2 <0 <1
<2 <0 <1
it doesnt change after the second swap
Any help would be awesome, also if you have comments/pointers about my style those would also be much appreciated, Thanks.
Sorry for long post.
PS - Also posted on SO:
http://stackoverflow.com/questions/6877504/johnson-trotter-algorithm