ArtOfCode.org
Toggle Menu
Home
Online Rust Compiler
Tutorials
Algorithms 101
Html Css Tutorial
Javascript Tutorial
Blog
All Posts
Graph Algorithms Core
Assess paths trees and traversals.
1. Which graph traversal algorithm uses a queue to explore nodes level by level?
DFS
BFS
Dijkstra's
Prim's
2. Which algorithm finds the shortest path from a single source to all other nodes in a weighted graph with non-negative edge weights?
Bellman-Ford
Dijkstra's
Kruskal's
Topological Sort
3. Which data structure is optimal for representing a dense graph (many edges)?
Adjacency List
Adjacency Matrix
Hash Table
Binary Search Tree
4. Topological sorting is applicable to which type of graph?
Undirected graph with cycles
Directed acyclic graph (DAG)
Bipartite graph
Weighted undirected graph
5. Which MST algorithm grows the tree from a single node by adding the cheapest connecting edge?
Kruskal's
Prim's
Dijkstra's
Bellman-Ford
6. Which traversal detects cycles in undirected graphs by tracking parent nodes?
BFS
DFS
Both BFS and DFS
Neither
7. Which algorithm detects negative weight cycles in a graph?
Dijkstra's
Prim's
Bellman-Ford
Kruskal's
8. A graph with E = O(V) edges is classified as:
Dense
Sparse
Complete
Bipartite
9. Which algorithms use a priority queue in their standard implementation?
Dijkstra's
Prim's
Kruskal's
BFS
10. Which are applications of Depth-First Search (DFS)?
Cycle detection
Topological sorting
Finding connected components
Shortest path in unweighted graph
11. Properties of a Minimum Spanning Tree (MST) include:
Contains all graph vertices
Has V-1 edges (V = vertices)
No cycles
Minimizes sum of edge weights
12. Valid graph representations include:
Adjacency List
Incidence Matrix
Adjacency Matrix
Binary Heap
13. Algorithms that handle negative weight edges (no negative cycles) for shortest paths:
Dijkstra's
Bellman-Ford
Floyd-Warshall
BFS
14. DFS uses a stack (explicitly or via recursion) to track nodes to visit.
True
False
15. Kruskal's algorithm uses union-find to avoid cycles when building an MST.
True
False
16. A single-node graph (no edges) has an MST with one edge.
True
False
17. A DAG has exactly one unique topological sort.
True
False
18. What does 'BFS' stand for in graph traversal?
19. Name the all-pairs shortest path algorithm (full name).
20. Abbreviation for the data structure Kruskal's uses to manage disjoint sets.
Reset
Answered 0 of 0 — 0 correct