Firstly, < means "to the left of".
So, is our first permutation.
Now, the largest integer k such that is 3, and the largest i such that is 4, so
swapping and noting that step 4 doesn't do anything,
is our next permutation.
Next, k=2, i=4 to get
Next, k=2, i=3 to get
Next, k=1, i=4 to get
Next, k=1, i=3 to get
Next, k=1, i=2 to get .
There should be 4!=24 permutations! Although step 4 never comes into it with what I did...(I tried to see it it perhaps meant "including a[k+1]", but if you do this between and (so permutations 3 and 4) then permutation 4 is the same as permutation 3, which can't happen!)
I have noticed wikipedia is often wrong when it comes to algorithms - I remember coming across an algorithm which it gave in pseudo code as well as in `proper' code. But these two versions of `the same' algorithm turned out to have vastly different efficiencies...!