title: Is there a sequence of swaps that would generate all possible permutations?
body: <p>You are given a list of numbers <code>1, 2, ... ,n</code> - is there a sequence of <code>n!-1</code> <code>swap</code> operations that would generate all <code>n!</code> permutations of the list where <code>swap (i, j)</code> swaps elements at cell <code>i</code> and <code>j</code>? What about the general case when the input list is not sorted to start with and/or there are repetitions in the list? </p>
  
  <p>Context: I am solving a problem where the "score" of an array is easy to calculate if you already know the score if 2 elements are swapped and I want to brute force (using C++ <code>next_permutation()</code>) all possible permutations.</p>