GATE Computer ScienceVery hardGATE CSE · UGC NET
A graph on vertices 0–5 has edges (0,1,1), (1,2,1), (0,2,1), (2,3,2), (1,3,2), (3,4,3), (2,4,3), (4,5,1). How many distinct minimum spanning trees (as edge sets) does it have?
- A. 14
- B. 10
- C. 12
- D. 16
Correct answer: C. 12
Two of the three triangle edges (3 ways), the bridge 4-5, one of two weight-2 edges to vertex 3 and one of two weight-3 edges to vertex 4 give 3 × 2 × 2 = 12.
More Algorithms questions
- How many inversions (pairs i<j with A[i]>A[j]) does the array [7, 3, 9, 1, 5, 8, 2] contain?
- Characters with frequencies 5, 9, 12, 13, 16, 45 are Huffman-coded. What is the total number of bits needed to encode the whole text (sum…
- Items have weights 3, 4, 5, 6, 2 and values 4, 5, 10, 11, 3. For the 0/1 knapsack with capacity 10, the maximum total value is
- What is the length of a longest common subsequence of X = "ABCBDABXYZ" and Y = "BDCABAZYX"?
- The edit distance (unit-cost insert, delete, substitute) between "algorithm" and "altruistic" is
- Six matrices have dimensions given by the sequence 5, 10, 3, 12, 5, 50, 6 (matrix i is p[i-1] × p[i]). The minimum number of scalar…