Final Flashcards
(38 cards)
Which data structure is used in BFS?
Queue
Is BFS suitable for finding the shortest path in an unweighted graph?
Yes
What is the time complexity of BFS in terms of V and E?
O(V + E)
Does BFS visit all nodes in a disconnected graph?
No
Which data structure is used in DFS (iterative)?
Stack
DFS can be used to detect cycles in which type of graph?
Both directed and undirected graphs
In DFS
what can be used to find articulation points and bridges?
What is the time complexity of DFS?
O(V + E)
Topological sorting applies to which type of graph?
Directed Acyclic Graph (DAG)
Which algorithms can perform topological sort?
Kahn’s Algorithm (BFS) and DFS-based
What is the order of nodes in topological sort useful for?
Task scheduling / dependency resolution
Topological sort is not possible if the graph has a
Cycle
A spanning tree must include all
Vertices with minimum number of edges
Number of edges in a spanning tree with n vertices is
n - 1
Can a graph have more than one spanning tree?
Yes
What is a minimum spanning tree?
A spanning tree with minimum total edge weight
What is an articulation point in a graph?
A vertex whose removal increases the number of connected components
Which algorithm is commonly used to find articulation points?
DFS with low-link values
Articulation points exist only in
Connected undirected graphs
Can a leaf node be an articulation point?
No
What are two common algorithms to find MST?
Prim’s and Kruskal’s
Can an MST exist in a disconnected graph?
No
Is MST unique for every graph?
No
Prim’s algorithm grows the MST by adding
The smallest edge connecting the tree to an outside vertex