Permutations
“Order matters”
There are two versions of the formula to calculate the number of permutations.
- When the order matters, use Permutations, and
- When the order doesn’t matter, use Combinations
Suppose we select slots from objects (where order matters), the number of ways this can be done is (” choose ”):
Think about it this way. You have objects to choose from for the first slot. You have objects to choose for the second slot, etc, until for the last slot you have objects to choose from. Thus, the answer is just:
Method 1
This is kind of similar to the Subsets logic, but be careful about the difference.
Method 2
Using Built in method in C++.
Example
Create a 3-letter word using A,B,C,D without replacement. In how many ways can the letters be arranged? Answer: