If A= {1,2,3,-2n} then find the number of derangements of the elements of A such that the first n elements of each of the derangements are the last n elements of A .
Answers
Step-by-step explanation:
Derangement is a permutation of n elements, such that no element appears in its original position. For example, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0}.
Given a number n, find the total number of Derangements of a set of n elements.
Examples :
Input: n = 2
Output: 1
For two elements say {0, 1}, there is only one
possible derangement {1, 0}
Input: n = 3
Output: 2
For three elements say {0, 1, 2}, there are two
possible derangements {2, 0, 1} and {1, 2, 0}
Input: n = 4
Output: 9
For four elements say {0, 1, 2, 3}, there are 9
possible derangements {1, 0, 3, 2} {1, 2, 3, 0}
{1, 3, 0, 2}, {2, 3, 0, 1}, {2, 0, 3, 1}, {2, 3,
1, 0}, {3, 0, 1, 2}, {3, 2, 0, 1} and {3, 2, 1, 0}
Recommended: Please solve it on “PRACTICE” first, before moving on to the solution.
Let countDer(n) be count of derangements for n elements. Below is the recursive relation to it.
countDer(n) = (n - 1) * [countDer(n - 1)