# Permutation, Combination and Subset

## Permutation

Number of ways to order a given input

{% hint style="info" %}
The key to find permutation is to store the value when it is same as input size while backtracking
{% endhint %}

> Example: permutations of ABCD, taken 3 at a time (24 variants): ABC, ACB, BAC, BCA, ...

## Combination

Number of ways of selecting input

They key to&#x20;

> Example: combination of ABCD, taken 3 at a time (4 variants): ABC, ABD, ACD, and BCD.

## Subset

Selection of objects from given set, considering all possible sizes of subsets. It includes subsets of different lengths, ranging from an empty subset to the full set itself.

{% hint style="info" %}
The key to find subset is store all the paths that are coming while performing backtracking.
{% endhint %}

> subset of ABCD: 'A', 'B', 'C', 'D,' 'AB' , 'AC', 'AD', 'BC', 'BD', 'CD', 'ABC', ...

&#x20;
