Given any integer N, we need to find out the number of Derangements for a set of N elements.
For this, we need to first understand what is a derangement.
Derangement: A derangement is a permutation of N elements, such that no element occurs in its original position.
For example, if N = 4, and the elements are {0, 1, 2, 3} , then {1, 0, 3, 2} , {2, 3, 0, 1} , {3, 2, 0, 1} ... are some derangements, where the elements do not occur in their original position. So, 0 should not be present in the 0t...
Published on February 15, 2021 01:53