GATE Computer ScienceVery hardGATE CS (PYQ pattern)
How many permutations of 7 distinct items have every cycle of length at least 3 (no fixed points and no 2-cycles)?
- A. 1854
- B. 1200
- C. 924
- D. 1140
Correct answer: D. 1140
Cycle types of 7 with all parts ≥ 3: (7): 6! = 720; (4,3): C(7,3)·2!·3! = 35·2·6 = 420. Total 1140. 1854 counts all derangements (also allowing 2-cycles).
More Algorithms questions
- Twelve symbols, all with the same frequency 1, are encoded with an optimal Huffman code. What is the total number of bits to encode one…
- In the hiring problem 10 candidates arrive in uniformly random order. The first 3 are only interviewed (never hired); from candidate 4 on…
- Karger's contraction algorithm is run on a connected multigraph with n = 8 vertices, but it stops when 4 super-vertices remain (instead of…
- Which of the following statements is/are correct? I. For metric TSP, doubling an MST and shortcutting gives a 2-approximation. II…
- A = [2, 5, 9, 14, 20, 27, 35, 41] and B = [1, 6, 8, 15, 22, 30, 33, 45, 50] are sorted. What is the 10th smallest element of the union of…
- How many non-empty contiguous subarrays of [3, 4, −7, 1, 3, 3, 1, −4, 2, 5, −3, 6] have sum exactly 7?