GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Bellman–Ford is run from A on the directed graph A→B 4, A→C 2, C→B 1, B→D 5, C→D 8, D→E 3, C→E 10, E→F −2, D→F 6. In each pass the edges are relaxed in this fixed order: D→F, E→F, D→E, C→E, B→D, C→D, C→B, A→C, A→B. What is the label of F after exactly 3 passes?
- A. 9
- B. 10
- C. 14
- D. ∞
Correct answer: B. 10
Pass 1 fixes only B = 4 and C = 2 (the edges out of D and E come first). Pass 2 gives D = 9, E = 12, B = 3 but F is relaxed before D and E have values. In pass 3, F becomes 10 via E = 12, while E only drops to 11 later in that pass (after D = 8); F = 9 appears in pass 4.
More Algorithms questions
- Assume P ≠ NP. Which of the following problems have a polynomial-time algorithm? I. 2-SAT. II. 3-colourability of a graph. III. Maximum…
- A polynomial-time many-one reduction from problem A to problem B is given (A ≤ₚ B). Which statements must be true? I. If B ∈ P then A ∈ P…
- Median-of-medians selection with groups of 7 satisfies T(n) ≤ T(n/7) + T(5n/7) + cn (ignore floors). Guessing T(n) ≤ an, what is the…
- Consider T(n) = 2T(n/2) + n/log₂²n for powers of 2, T(1) = 1. Which is the tight asymptotic bound?
- T(n) = 4T(n/2) + n² log₂ n. Which is the tight solution?
- Binary search on a sorted array of 1000 distinct keys uses mid = ⌊(lo + hi)/2⌋ and counts one probe per element compared (the search stops…