Question
Let be a graph with vertices, with each vertex labelled by a distinct permutation of the numbers . There is an edge between vertices and if and only if the label of can be obtained by swapping two adjacent numbers in the label of . Let denote the degree of a vertex in , and denote the number of connected components in .
Then, _____.
Official answer and solution
- Official answer
- 109
- From
- Official GATE 2018 answer key
Solution
Determine vertex degree from adjacent transposition count, and connectivity from permutation generation properties.
In a permutation of length 100, there are adjacent positions: . Swapping any of these 99 adjacent pairs produces a distinct new permutation. Thus, every vertex has degree .
Any permutation of can be generated from any other permutation using a finite sequence of adjacent transpositions (the foundation of algorithms such as bubble sort). Thus, the graph is fully connected, meaning the number of connected components is .
Compute the required expression:
109
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2018 Computer Science and Information Technology (CS)
- Question
- 53 of 65, printed as CS Q.43
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.