Take the example of generating the permutations of the array ['a', 'b', 'c', 'd'].
Assume that the function named generate(n, arr) with two parameters: n is the length of the array; and the arr is the array to be dealt with.
And the calling statement would be: generate(4, ['a', 'b', 'c', 'd']);.
There's a for loop inside the algorithm. So: