(1) if    then
(2) output the generated sequence
(3) return
(4) else
(5) 
(6) while    do
(7)  swap(, )
(8)  call  
(9)  swap(, )
(10)  
(11) end while
(12) end if
Algorithm 4: recursive_permutation(i) (enumerate sequences from th to the last element).