Shortest Path & Dijkstra's Algorithm Flashcards

(7 cards)

1
Q

What is the goal of Shortest path algorithms ?

A

Find the most efficient route through a graph based on edge weights.

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

What are the variations of shortest path algorithms ?

A

Single-Source Shortest Path (SSSP): From one node to all others,
Single-Destination Shortest Path (SDSP): from all nodes to one,
All-Pairs Shortest Path (APSP): BEtween every pair of nodes.

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

What is Dijkstra’s Algorithm ?

A

SSSP algorithm with non-negative weights,
Greedy approach: always picks the node with the shortest know distance,
D array - Distance estimates from the start node,
T array - Tracks which nodes are tight (final shortest distance known)
P array - Records predecessors to reconstruct the actual path.
Array based: O(V^2)
Binary heap: O((V+E) log V)

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

When is Dijkstra’s Algorithm used ?

A

GPS/Navigation,
Network Routing,
Game AI pathing,
Robotics motion planning.

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

What is a Minimal Spanning Tree (MST) ?

A

A subtree of the edges of a graph that connects all nodes within the graph.

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

What is Prim’s Algorithm ?

A

Starts from a vertex, grows MST by adding the smallest-weight edge from inside the tree,
Best for dense graphs,
Time Complexity: O(|E| + |V| log |V|) with Fibonacci heap.

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

What is Kruskal’s Algorithm ?

A

Starts with edges; adds the smallest edge that doesnt’t form a cycle using disjoint-set structure,
Best for sparse graphs,
Time Complexity: O(|E| log |V|).

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