GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A directed graph has edges 0→1 (3), 1→2 (2), 2→0 (4), 1→3 (1), 3→4 (5), 4→1 (−1), 2→4 (6), 4→0 (2), 3→0 (1). What is the minimum mean weight over all directed cycles?
- A. 3/2
- B. 2
- C. 5/3
- D. 7/3
Correct answer: C. 5/3
Enumerating simple cycles (the minimum mean cycle is always simple): 0→1→3→0 has weight 5 over 3 edges, and 1→3→4→1 also has 5 over 3 edges, giving 5/3; no cycle is cheaper (for example 0→1→2→0 has mean 3). Karp's algorithm computes it in O(VE).
More Algorithms questions
- How many spanning trees does K₅ minus one edge have (5 vertices, all pairs joined except one)?
- How many times does x++ execute? for (i = 1; i < 200; i = 2) for (j = i; j < 200; j += i) x++;
- The solution of the recurrence T(n) = 2T(n/2) + n/log n (with T(1) = 1, logs base 2) is:
- The solution of T(n) = 4T(n/2) + n² log n is:
- Matrices A1 to A6 have dimensions 5×40, 40×10, 10×30, 30×8, 8×25 and 25×6. The minimum number of scalar multiplications needed to compute…
- A text uses 8 symbols with frequencies 5, 9, 12, 13, 16, 45, 3 and 7. If a Huffman code is built, the total number of bits needed for the…