Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Graph AlgorithmsEasy
Q1. What is Breadth-First Search (BFS)?
- A.A search that goes as deep as possible first
- B.A search only applicable to tree structures
- C.A search that uses a stack data structure
- D.A search exploring all neighbors at current depth✓ Correct
Explanation
BFS explores all vertices at the current depth level before moving to the next level, using a queue data structure.
Report an error in this question
Graph AlgorithmsEasy
Q2. What is Depth-First Search (DFS)?
- A.A search going deep along each branch first✓ Correct
- B.A search only applicable to array structures
- C.A search that uses a queue data structure
- D.A search that explores all neighbors first
Explanation
DFS explores as far as possible along each branch before backtracking, using a stack (or recursion).
Report an error in this question
Graph AlgorithmsEasy
Q3. What data structure does BFS use?
- A.Hash table
- B.Heap
- C.Stack
- D.Queue✓ Correct
Explanation
BFS uses a queue to maintain the order of vertices to visit, processing them in FIFO order.
Report an error in this question
Graph AlgorithmsEasy
Q4. What data structure does DFS use?
- A.Array structure
- B.Stack or recursion✓ Correct
- C.Queue structure
- D.Heap structure
Explanation
DFS uses a stack (explicitly or via recursion's call stack) to track vertices to visit.
Report an error in this question
Graph AlgorithmsEasy
Q5. What is the time complexity of BFS on a graph with V vertices and E edges?
- A.O(V + E)✓ Correct
- B.O(E)
- C.O(V × E)
- D.O(V)
Explanation
BFS visits each vertex and explores each edge once, giving O(V + E) time complexity.
Report an error in this question
Graph AlgorithmsEasy
Q6. What is the time complexity of DFS on a graph with V vertices and E edges?
- A.O(V + E)✓ Correct
- B.O(V × E)
- C.O(E^2)
- D.O(V^2)
Explanation
DFS visits each vertex and explores each edge once, giving O(V + E) time complexity.
Report an error in this question
Graph AlgorithmsEasy
Q7. Can BFS find the shortest path in an unweighted graph?
- A.Yes, BFS can do this✓ Correct
- B.No, BFS cannot do this
- C.Only in tree structures
- D.Only in directed graphs
Explanation
BFS finds the shortest path (minimum number of edges) from a source to all other vertices in an unweighted graph.
Report an error in this question
Graph AlgorithmsEasy
Q8. What is a connected component in an undirected graph?
- A.A cycle within the undirected graph
- B.A maximal set of vertices all connected by paths✓ Correct
- C.An edge connecting two vertices together
- D.A single isolated vertex in the graph
Explanation
A connected component is a maximal subset of vertices where every pair of vertices is connected by a path.
Report an error in this question
Graph AlgorithmsEasy
Q9. What is a cycle in a graph?
- A.An isolated vertex with no edges at all
- B.A path starting and ending at the same vertex✓ Correct
- C.A straight path between two vertices
- D.A tree edge connecting parent to child
Explanation
A cycle is a path in a graph that starts and ends at the same vertex, visiting at least one other vertex, with no repeated edges.
Report an error in this question
Graph AlgorithmsEasy
Q10. What is a spanning tree of a connected graph?
- A.A subgraph with all vertices and all edges
- B.A complete subgraph with maximum edges
- C.A tree subgraph containing all graph vertices✓ Correct
- D.The shortest path tree from one source
Explanation
A spanning tree is a subgraph that includes all vertices of the graph, is connected, and has no cycles (V-1 edges for V vertices).
Report an error in this question
Graph AlgorithmsMedium
Q11. What is Dijkstra's algorithm used for?
- A.Finding all cycles in a given graph
- B.Finding shortest paths with non-negative weights✓ Correct
- C.Sorting all vertices by their degree
- D.Finding connected components in a graph
Explanation
Dijkstra's algorithm finds the shortest path from a single source vertex to all other vertices in a graph with non-negative edge weights.
Report an error in this question
Graph AlgorithmsMedium
Q12. What is the time complexity of Dijkstra's algorithm using a binary heap?
- A.O(V × E)
- B.O(V + E)
- C.O((V + E) log V)✓ Correct
- D.O(V^2)
Explanation
Using a binary heap (priority queue), Dijkstra's algorithm runs in O((V + E) log V) time.
Report an error in this question
Graph AlgorithmsMedium
Q13. What is Kruskal's algorithm used for?
- A.Shortest path computation
- B.Topological sorting of vertices
- C.Cycle detection in graphs
- D.Finding Minimum Spanning Tree✓ Correct
Explanation
Kruskal's algorithm finds the Minimum Spanning Tree by sorting edges by weight and adding them if they don't form a cycle (using Union-Find).
Report an error in this question
Graph AlgorithmsMedium
Q14. What is Prim's algorithm used for?
- A.Shortest path computation
- B.Finding Minimum Spanning Tree✓ Correct
- C.Graph coloring assignment
- D.Topological sort ordering
Explanation
Prim's algorithm finds the MST by starting from a vertex and greedily adding the cheapest edge connecting the tree to a vertex not yet in the tree.
Report an error in this question
Graph AlgorithmsMedium
Q15. What is topological sorting?
- A.Linear ordering of DAG vertices respecting edge directions✓ Correct
- B.Sorting edges by their assigned weight values
- C.Sorting all vertices by their numeric label values
- D.Sorting all vertices by their in-degree values
Explanation
Topological sort produces a linear ordering of vertices in a Directed Acyclic Graph (DAG) where every directed edge goes from earlier to later in the ordering.
Report an error in this question
Graph AlgorithmsMedium
Q16. What type of graph is required for topological sorting?
- A.An undirected graph type
- B.A complete graph type
- C.A weighted graph type
- D.Directed Acyclic Graph (DAG)✓ Correct
Explanation
Topological sorting is only possible on Directed Acyclic Graphs (DAGs). A cycle would make it impossible to define a valid ordering.
Report an error in this question
Graph AlgorithmsMedium
Q17. What is the Bellman-Ford algorithm used for?
- A.Finding connected components in undirected graphs
- B.Finding the Minimum Spanning Tree of a graph
- C.Finding shortest paths even with negative weights✓ Correct
- D.Topological sorting of directed acyclic graphs
Explanation
Bellman-Ford finds shortest paths from a single source and can handle negative edge weights. It also detects negative weight cycles.
Report an error in this question
Graph AlgorithmsMedium
Q18. What is the time complexity of the Bellman-Ford algorithm?
- A.O(V × E)✓ Correct
- B.O(V + E)
- C.O(V^2)
- D.O(E log V)
Explanation
Bellman-Ford relaxes all E edges V-1 times, giving O(V × E) time complexity.
Report an error in this question
Graph AlgorithmsMedium
Q19. How can you detect a cycle in a directed graph?
- A.By counting edges in the graph
- B.Using DFS and checking for back edges✓ Correct
- C.Using BFS traversal only
- D.By finding the shortest path first
Explanation
A cycle in a directed graph can be detected using DFS: if a back edge (to an ancestor in the DFS tree) is found, a cycle exists.
Report an error in this question
Graph AlgorithmsMedium
Q20. What is the Union-Find (Disjoint Set Union) data structure used for?
- A.Finding shortest paths between graph vertices
- B.Storing key-value pairs with fast lookup
- C.Tracking set membership and merging sets efficiently✓ Correct
- D.Sorting elements into ordered groups
Explanation
Union-Find efficiently supports union (merge two sets) and find (determine which set an element belongs to) operations, commonly used in Kruskal's MST algorithm.
Report an error in this question
Graph AlgorithmsHard
Q21. What is the Floyd-Warshall algorithm?
- A.An all-pairs shortest path DP algorithm✓ Correct
- B.A minimum spanning tree algorithm only
- C.A single-source shortest path algorithm
- D.A graph coloring assignment algorithm
Explanation
Floyd-Warshall computes shortest paths between all pairs of vertices using dynamic programming in O(V^3) time.
Report an error in this question
Graph AlgorithmsHard
Q22. What is the time complexity of Floyd-Warshall algorithm?
- A.O(V^3)✓ Correct
- B.O(V^2)
- C.O(V × E)
- D.O(V + E)
Explanation
Floyd-Warshall uses three nested loops over V vertices, giving O(V^3) time complexity.
Report an error in this question
Graph AlgorithmsHard
Q23. What are Strongly Connected Components (SCCs) in a directed graph?
- A.Maximal subgraphs with mutual reachability✓ Correct
- B.Components with no cycles at all
- C.Components with the most vertices total
- D.Components with the most edges overall
Explanation
An SCC is a maximal set of vertices where every pair of vertices is mutually reachable via directed paths.
Report an error in this question
Graph AlgorithmsHard
Q24. Which algorithms can find Strongly Connected Components?
- A.Dijkstra's shortest path algorithm
- B.Prim's spanning tree algorithm
- C.Kosaraju's and Tarjan's algorithms✓ Correct
- D.Floyd-Warshall all-pairs algorithm
Explanation
Kosaraju's algorithm (two DFS passes) and Tarjan's algorithm (single DFS with stack) both find SCCs in O(V + E) time.
Report an error in this question
Graph AlgorithmsHard
Q25. What is an articulation point (cut vertex) in a graph?
- A.A vertex with no edges connected to it
- B.The vertex with the smallest key value
- C.A vertex whose removal disconnects the graph✓ Correct
- D.A vertex with the maximum degree overall
Explanation
An articulation point is a vertex whose removal (along with its edges) increases the number of connected components in the graph.
Report an error in this question
Graph AlgorithmsHard
Q26. What is a bridge in a graph?
- A.An edge with the maximum weight assigned
- B.An edge whose removal disconnects the graph✓ Correct
- C.The longest edge in the graph by weight
- D.An edge connecting two separate components
Explanation
A bridge is an edge whose removal increases the number of connected components. It can be found using modified DFS in O(V + E) time.
Report an error in this question
Graph AlgorithmsHard
Q27. What is the maximum flow problem?
- A.Finding the maximum number of vertices
- B.Finding maximum flow from source to sink✓ Correct
- C.Finding the maximum edge weight in graph
- D.Sorting edges by their flow capacity
Explanation
The maximum flow problem finds the greatest rate of flow through a flow network from a source to a sink, respecting edge capacities.
Report an error in this question
Graph AlgorithmsHard
Q28. What is the Ford-Fulkerson method for maximum flow?
- A.An iterative method finding augmenting paths until none remain✓ Correct
- B.A divide and conquer approach for solving network flows
- C.A greedy algorithm for computing the minimum cut value
- D.A dynamic programming approach for computing max flow
Explanation
Ford-Fulkerson repeatedly finds augmenting paths from source to sink in the residual graph and increases flow along those paths until no augmenting path exists.
Report an error in this question
Graph AlgorithmsHard
Q29. What does the Max-Flow Min-Cut theorem state?
- A.Maximum flow equals the number of all paths
- B.Maximum flow equals minimum edge weight
- C.Maximum flow equals the minimum cut capacity✓ Correct
- D.Minimum cut equals the total number of edges
Explanation
The Max-Flow Min-Cut theorem states that the maximum flow from source to sink equals the minimum total capacity of edges in a cut that separates source and sink.
Report an error in this question
Graph AlgorithmsHard
Q30. What is the time complexity of Dijkstra's algorithm with a Fibonacci heap?
- A.O(V × E)
- B.O((V + E) log V)
- C.O(V log V + E)✓ Correct
- D.O(V^2)
Explanation
Using a Fibonacci heap, Dijkstra's algorithm achieves O(V log V + E) time, improving the decrease-key operation to amortized O(1).
Report an error in this question