GATE 2026 Algorithms PYQs | GREEDY METHOD

Last Updated :
Discuss
Comments

Question 1

G = (V, E ) is an undirected simple graph in which each edge has a distinct weight, and e is a particular edge of G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are TRUE?

I. If e is the lightest edge of some cycle in G, then every MST of G includes e

II. If e is the heaviest edge of some cycle in G, then every MST of G excludes e
GATE CSE 2016,SET1 - [2Marks] (MCQ)


  • I only

  • II only

  • both I and II

  • neither I and II

Question 2

Let G be a weighted directed acyclic graph with m edges and n vertices. Given G and a source vertex s in G, which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from s to all vertices that are reachable from s in G? [GATE 2026 || SET-2 MCQ || 2-mark]

  • Θ(m + n)

  • Θ(m + n log(n))

  • Θ(nm)

  • Θ(nΒ³)

Question 3

Let 𝐺(𝑉,𝐸) be a simple, undirected, edge-weighted graph with unique edge weights. Which of the following statements about the minimum spanning trees (MST) of 𝐺 is/are true? [GATE 2026 || SET-1 MSQ || 2-mark]

  • In every cycle 𝐢 of 𝐺, the edge with the largest weight in 𝐢 is not in any MST

  • In every cycle 𝐢 of 𝐺, the edge with the smallest weight in 𝐢 is in every MST

  • For every vertex 𝑣 βˆˆπ‘‰, the edge with the largest weight incident on 𝑣 is not in any MST

  • For every vertex 𝑣 βˆˆπ‘‰, the edge with the smallest weight incident on 𝑣 is in every MST

Question 4

[Tex]\begin{aligned} &\text{Let } G(V,E) \text{ be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.Let } s \in V \text{ be a vertex in } G\text{. For every } u \in V \text{ and for every } k \ge 0\text{, let } d_k(u) \text{ denote the weight of a shortest path (in terms of weight) from } s \text{ to } u \text{ of length at most } k\text{. If there is no path from } s \text{ to } u \text{ of length at most } k\text{, then } d_k(u) = \infty\text{.Consider the statements:} \\ &\text{S1: For every } k \ge 0 \text{ and } u \in V,\ d_{k+1}(u) \le d_k(u). \\ &\text{S2: For every } (u,v) \in E\text{, if } (u,v) \text{ is part of a shortest} \\ &\qquad \text{path (in terms of weight) from } s \text{ to } v\text{, then for} \\ &\qquad \text{every } k \ge 0, d_k(u) \le d_k(v). \\ &\text{Which one of the following options is correct?} \end{aligned}[/Tex]
[GATE 2026 || SET-1 MCQ || 2-mark]

  • Only S1 is true

  • Only S2 is true

  • Both S1 and S2 are true

  • Neither S1 nor S2 is true

Question 5

Let G be any undirected graph with positive edge weights, and T be a minimum spanning tree of G. For any two vertices, u and v, let d1(u,v) and d2(u,v) be the shortest distances between u and v in G and T, respectively. Which ONE of the options is CORRECT for all possible G, T, u and v?
GATE CSE 2025,SET1 - [1Marks] (MCQ)



  • d1​(u, v) = d2​(u, v)

  • d1​(u, v) ≀ d2​(u, v)

  • d1​(u, v) β‰₯ d2​(u, v)

  • d1​(u, v) != d2​(u, v)

Question 6

​​​​Let G be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant Ξ± is added to the weight of every edge.

Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in G before and after the edge weight update?
GATE CSE 2025,SET2 - [2Marks] (MCQ)


  • Every MST remains an MST, and every SP remains an SP.

  • MSTs need not remain MSTs, and every SP remains an SP

  • Every MST remains an MST, and SPs need not remain SPs

  • MSTs need not remain MSTs, and SPs need not remain SPs

Question 7

Consider a simple undirected weighted graph G, all of whose edge weights are distinct.

Which of the following statements about the minimum spanning trees of G is/are TRUE?
GATE CSE 2022 - [2Marks] (MSQ)


  • The edge with the second smallest weight is always part of any minimum spanning tree of G.

  • One or both of the edges with the third smallest and the fourth smallest weights are part of any minimum spanning tree of G

  • Suppose SβŠ†V be such that S != Ο• and S != V. Consider the edge with the minimum weight such that one of its vertices is in S and the other in Vβˆ–S. Such an edge will always be part of any minimum spanning tree of G

  • G can have multiple minimum spanning trees.

Question 8

Consider the weighted undirected graph with 4 vertices, where the weight of edge {i, j} is given by the entry W ij Β in the matrix W.

Screenshot-2025-05-10-112831
.

The largest possible integer value of x, for which at least one shortest path between some pair of vertices will contain the edge with weight x is______.
GATE CSE 2016,SET1 - [2Marks] (NAT)

Question 9

Let G be a connected undirected weighted graph. Consider the following two statements.

S 1 : There exists a minimum weight edge in G which is present in every minimum spanning tree of G.

S 2 : If every edge in G has distinct weight, then G has a unique minimum spanning tree.

Which one of the following options is correct?
GATE CSE 2021,SET2 - [2Marks] (MCQ)


  • S 1 is true and S 2 is false.

  • S 1 is false and S 2 is true.

  • Both S 1 and S 2 are true.

  • Both S 1 and S 2 are false.

Question 10

Screenshot-2025-10-15-162418
ques

Which one of the following statements is true?
GATE CSE 2021,SET1 - [2Marks] (MCQ)


  • ⌈ diam (G) / 2βŒ‰ < diam (G 2 ) < diam(G)

  • diam(G 2 ) = diam(G)

  • diam(G) = diam(G 2 ) <= 2 diam(G)

  • diam(G 2 ) <= ⌈ diam (G) / 2 βŒ‰

Tags:

There are 30 questions to complete.

Take a part in the ongoing discussion