CS2004_Graph_Traversal_Flashcards

(10 cards)

1
Q

What is Depth-First Search (DFS)?

A

DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking.

✅ Uses a stack (or recursion) to track the path.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Breadth-First Search (BFS)?

A

BFS is a graph traversal algorithm that explores all neighbours of a node before moving to the next level.

✅ Uses a queue to maintain the order of exploration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the time complexity of BFS and DFS?

A

Both BFS and DFS run in O(V + E), where V is the number of vertices and E is the number of edges.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Dijkstra’s Algorithm used for?

A

Dijkstra’s algorithm finds the shortest path from a starting node to all other nodes in a weighted graph with non-negative edge weights.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does Dijkstra’s algorithm work?

A

It uses a priority queue to explore the lowest-cost node first and updates distances to neighbours based on cumulative cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is A* search?

A

A* is a pathfinding algorithm that uses both actual cost from the start and estimated cost to the goal (via a heuristic).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the key difference between A* and Dijkstra’s Algorithm?

A

A* uses a heuristic to guide the search, making it more efficient for goal-directed searches.

✅ Dijkstra is uninformed; A* is informed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Minimum Spanning Tree (MST)?

A

An MST is a subset of edges in a connected, weighted graph that connects all vertices with the minimum total edge weight and no cycles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Prim’s Algorithm?

A

Prim’s algorithm builds the MST by starting from one node and repeatedly adding the smallest edge connecting the tree to a new node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Kruskal’s Algorithm?

A

Kruskal’s algorithm builds the MST by sorting all edges by weight and adding them one by one, avoiding cycles using disjoint sets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly