IAE Academy

GATE 2023 CS Q.48: solution and answer

GATE 2023 · CSQ.48 · 2 marks · MCQ

Let , where is a large positive integer greater than 1000. Let be a positive integer less than . Let be subsets of with and . We say that a permutation of separates from if one of the following is true.

  • All members of appear in the permutation before any of the members of .
  • All members of appear in the permutation before any of the members of .

How many permutations of separate from ?

  1. (A)

  2. (B)

  3. (C)

  4. (D)

See the question in the paper

Answer and solution

ANSWER

The number of permutations that separate from is , option (D).

Official answer: DSource: Official answer key, GATE 2023 CS (IIT Kanpur)

  1. Count the permutations in which every member of comes before every member of , then double the count for the symmetric case in which comes first.

  2. Choose which of the positions hold the members of . This can be done in ways.

  3. Read those positions from left to right. For to come entirely before , the first of them must hold and the last must hold . This is forced, so it adds no extra choice.

  4. Arrange the members of in their positions in ways. Arrange the members of in their positions in ways.

  5. Arrange the remaining elements of in the remaining positions in ways.

  6. The number of permutations with entirely before is .

  7. The number with entirely before is the same, by symmetry. The two cases cannot overlap: and are disjoint and non-empty, so a permutation cannot have both before and before .

  8. Total: , which is option (D).

  9. Check on small cases. For , : the formula gives , and both permutations of separate. For , : the formula gives , and every permutation separates two single elements.

KEY IDEA

Pick the positions of , and the order within them is forced (the first for one set, the last for the other). Then arrange each group and the rest, and multiply by 2 for the two possible orders of the sets.

WATCH OUT FOR

Forgetting the factor 2 for appearing before gives option (C). Forgetting the internal orderings gives option (B).

From the GATE 2023 CS paper. Every question of this paper · Download the full paper · All 6 Counting questions, with notes

More Counting questions