GATE 2006
191 questions
MCQ 1911-mark 191
Questions 21–25 of 191
The vertices of graph G correspond to all subsets of a set of size n, for . Two vertices of G are adjacent if and only if the corresponding sets intersect in exactly two elements.
The number of vertices of degree zero in G is
The number of vertices of degree zero in G is
Answer: (C)
Two vertices (sets) are adjacent when they share exactly two elements.
Sets of size at most have degree zero. Such a set has for every set , so it can never share exactly two elements with another set. These sets are the empty set and the single-element sets, which is sets.
Sets of size or more have degree at least .
- If , then is adjacent to for any (this exists because ). The two sets share exactly the two elements of .
- If , then is adjacent to any of its -element subsets, which share exactly two elements with .
So the number of vertices of degree zero is .
Answer: (C)
Sets of size at most have degree zero. Such a set has for every set , so it can never share exactly two elements with another set. These sets are the empty set and the single-element sets, which is sets.
Sets of size or more have degree at least .
- If , then is adjacent to for any (this exists because ). The two sets share exactly the two elements of .
- If , then is adjacent to any of its -element subsets, which share exactly two elements with .
So the number of vertices of degree zero is .
Answer: (C)
Let T be a depth first search tree in a undirected graph G Vertices u and v are leaves of this tree T. The degrees of both u and v in G are at least 2. Which one of the following statements is true?
Answer: (D)
Key fact: in a DFS of an undirected graph, every non-tree edge joins a vertex to one of its ancestors (back edge). There are no cross edges.
Why D is true. The leaf u has no children, so all its neighbours are ancestors of u, which all lie on the tree path from the root to u. Let w be the neighbour of u closest to the root. The tree path from w down to u contains every neighbour of u, and the edge (u, w) closes it into a cycle. The parent of u is one neighbour, and u has at least 2 neighbours, so w is above the parent and the cycle has length at least 3. So there is a cycle through u and all its neighbours.
Why the others are not always true (each example has two leaves u and v of degree 2):
- Take two triangles {1, 2, u} and {3, 4, v} joined by the edge 2-3. A DFS from 1 has leaves u and v. They have no common neighbour, so A fails. No cycle contains both u and v, since the bridge 2-3 would be used twice, so C fails.
- Take the complete bipartite graph with parts {x, y} and {a, b, c}. A DFS from x going x, a, y, b, then c has leaves b and c. Removing any one vertex leaves them connected, so B fails.
Answer: (D)
Why D is true. The leaf u has no children, so all its neighbours are ancestors of u, which all lie on the tree path from the root to u. Let w be the neighbour of u closest to the root. The tree path from w down to u contains every neighbour of u, and the edge (u, w) closes it into a cycle. The parent of u is one neighbour, and u has at least 2 neighbours, so w is above the parent and the cycle has length at least 3. So there is a cycle through u and all its neighbours.
Why the others are not always true (each example has two leaves u and v of degree 2):
- Take two triangles {1, 2, u} and {3, 4, v} joined by the edge 2-3. A DFS from 1 has leaves u and v. They have no common neighbour, so A fails. No cycle contains both u and v, since the bridge 2-3 would be used twice, so C fails.
- Take the complete bipartite graph with parts {x, y} and {a, b, c}. A DFS from x going x, a, y, b, then c has leaves b and c. Removing any one vertex leaves them connected, so B fails.
Answer: (D)
Let SHAM3 be the problem of finding a Hamiltonian cycle in a graph G=(V,E) with |V| divisible by 3 and DHAM3 be the problem of determining if a Hamltonian cycle exists in such graphs. Which one of the following is true?
Answer: (A)
SHAM3 asks to find a Hamiltonian cycle and DHAM3 asks only whether one exists. Both are restricted to graphs with |V| divisible by 3.
DHAM3 is NP-hard. Hamiltonian cycle is NP-complete for general graphs. Given any graph G with n vertices, replace one vertex v by three vertices: and joined to all neighbours of v, and a middle vertex joined only to and . Because has degree 2, any Hamiltonian cycle must go , which acts exactly like passing through v. So the new graph has a Hamiltonian cycle if and only if G has one, and it has 2 more vertices. Doing this 0, 1 or 2 times makes the number of vertices a multiple of 3. This is a polynomial-time reduction, so DHAM3 is NP-hard.
SHAM3 is NP-hard. If we could find a Hamiltonian cycle in polynomial time, we could decide existence too: answer yes when a cycle is returned and no otherwise. So finding is at least as hard as deciding, and SHAM3 is NP-hard as well.
So both are NP-hard.
Answer: (A)
DHAM3 is NP-hard. Hamiltonian cycle is NP-complete for general graphs. Given any graph G with n vertices, replace one vertex v by three vertices: and joined to all neighbours of v, and a middle vertex joined only to and . Because has degree 2, any Hamiltonian cycle must go , which acts exactly like passing through v. So the new graph has a Hamiltonian cycle if and only if G has one, and it has 2 more vertices. Doing this 0, 1 or 2 times makes the number of vertices a multiple of 3. This is a polynomial-time reduction, so DHAM3 is NP-hard.
SHAM3 is NP-hard. If we could find a Hamiltonian cycle in polynomial time, we could decide existence too: answer yes when a cycle is returned and no otherwise. So finding is at least as hard as deciding, and SHAM3 is NP-hard as well.
So both are NP-hard.
Answer: (A)
In the 4B/5B encoding scheme, every 4 bits of data are encoded in a 5-bit codeword.
It is required that the codewords have at most 1 leading and at most 1 trailing zero.
How many are such codewords possible?
It is required that the codewords have at most 1 leading and at most 1 trailing zero.
How many are such codewords possible?
Answer: (C)
A 5-bit codeword has at most 1 leading zero and at most 1 trailing zero when its first two bits are not both 0 and its last two bits are not both 0. Count the 32 codewords and remove the bad ones.
- First two bits 00: , so codewords.
- Last two bits 00: , so codewords.
- Both: , so codewords (counted in both lines above).
- Bad codewords: .
Valid codewords: .
Answer: (C)
- First two bits 00: , so codewords.
- Last two bits 00: , so codewords.
- Both: , so codewords (counted in both lines above).
- Bad codewords: .
Valid codewords: .
Answer: (C)
What is the cardinality of the set of integers X defined below?
, n is not divisible by either 2, 3 or 5}
, n is not divisible by either 2, 3 or 5}
Answer: (B)
Let be the sets of numbers in that are divisible by 2, 3 and 5. holds the numbers that are in none of them, so . Use inclusion-exclusion with for the multiples of :
, ,
, ,
Answer: (B)
, ,
, ,
Answer: (B)