Which of the following applications directly use the Union-Find data structure?
GATE CSE · Algorithms
Master topic for Graph Traversal. Includes Breadth First Search (BFS), Depth First Search (DFS), Topological Sorting.
152 questions · 0 PYQs · 20 AI practice · GATE CSE 2027
Which of the following applications directly use the Union-Find data structure?
Which data structure is primarily used to implement Depth First Search (DFS)?
In a naive Union-Find implementation using an array (where parent[i] = i for roots), without any optimization, what is the worst-case time complexity of FIND(x) on n elements?
In BFS on an undirected connected graph , which of the following statements about non-tree edges are TRUE?
Which of the following statements about DFS on a directed graph are TRUE?
Consider a complete graph (every pair of vertices connected by an edge) with vertices. BFS is started from any vertex . What is the maximum depth (number of levels) of the BFS tree?
In task scheduling, topological sorting is used to determine a valid execution order for tasks with dependencies. If a system has n tasks and m dependency constraints (edges in the DAG), the time to compute a valid schedule using topological sort is:
Kahn's algorithm for topological sorting can also be used to detect cycles in a directed graph. How is cycle detection performed using Kahn's algorithm?
Initially, 8 elements {1,...,8} are each in their own set. After performing UNION operations using union by size (always attach smaller size tree under larger; ties broken by attaching second argument under first), the following unions are done: UNION(1,2), UNION(3,4), UNION(5,6), UNION(7,8), UNION(1,3), UNION(5,7), UNION(1,5). What is the maximum depth of any element from the root?
Consider a connected undirected graph G with n vertices. DFS is performed and the DFS tree is obtained. If the DFS tree has exactly n-1 tree edges, what is the maximum number of back edges possible in the DFS of G?
Consider a graph G with 6 vertices and the following adjacency list (sorted): 1: [2,3], 2: [4], 3: [4,5], 4: [6], 5: [6], 6: []. DFS is performed from vertex 1. What is the total number of tree edges in the resulting DFS tree?
Union by size attaches the smaller tree under the larger tree (by number of nodes). With union by size alone (no path compression) on n elements, what is the worst-case time complexity of a single FIND operation?
The amortized time complexity of Union-Find with both path compression and union by rank for a sequence of m operations (FIND and UNION) on n elements is:
Kahn's algorithm for topological sorting uses which data structure to process vertices with in-degree 0?
The maximum size of the queue at any point during BFS on a graph with vertices and edges is:
An undirected graph G has n vertices and m edges. DFS is performed on G. What is the time complexity of DFS if the graph is represented using an adjacency list?
Consider a directed graph with n vertices. DFS is performed from a source vertex s, and all n vertices are visited. What can be concluded about the graph?
Given a graph with V vertices and no edges, how many DFS calls are required to traverse all vertices?
Consider the following directed graph.
[IMAGE: Directed graph with 6 vertices {A, B, C, D, E, F}. Directed edges: A→B, B→C, C→A, D→B, D→E, E→F]
Kahn's algorithm is run on this graph. How many vertices appear in the topological output?
Which of the following problems use topological sorting as a key subroutine?
Want unlimited AI-generated Graph Traversal questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →