0

Method to calculate the number of derangements for any given 'n'(length of permutation) : https://en.wikipedia.org/wiki/Derangement

Suppose, for n = 3, the derangements are as follows : -

1 : {3,1,2}

2 : {2,3,1}

(Meaning of derangement : All permutations of {1,2,3} such that no element in the permutation occurs at it's original index )

But , the new problem is : If only first 'k' indices need to be deranged , then how many permutations are possible ?

Example : -

n=2 and k=2 ,

Answer : (3-ways)

1){2,1,3}

2){2,3,1}

3){3,1,2}

0 Answers0