What is a Permutation Algorithm?

Permutation algorithm is the process of choosing r things out of n possible things, where r <= n.
Mathematical formula is :
n! / (n -r)!

Note that each of the collection of r things are considered different EVEN in order in which they are chosen.

For example, for objects , a,a,b,b,c,c,d,d. We have n =8.
Suppose r = 3. Then, these collections ( a,b,c ) and
( a,c,b ) are considered different because order is important here. Note that ( a,b,c ) here denotes that the case where a is chosen first, b second, and c third.

Its counterpart is the concept of combination of things as opposed to pemutation of things mentioned above. In the combination concept, using the example above, the collections ( a,b,c ) and ( a,c,b ) are considered same because order is NOT important here.

Thus permutation counts the number of ways r things can be chosen from a total of n things with regard to order in which the objects are selected.

On the other hand, in like manner one can define combination as one counts the number of ways r things can be chosen from a total of n things without regard for the order in which the objects are selected. The mathematical formula here is
n!/ [ (n -r)! r! ]