Permutation, Combination and Subset

Permutation

Number of ways to order a given input

The key to find permutation is to store the value when it is same as input size while backtracking

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

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.

The key to find subset is store all the paths that are coming while performing backtracking.

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

Last updated

Was this helpful?