SW19: Shortest Paths (Dijkstra's Algorithm) Flashcards

(20 cards)

1
Q

Fill in the Blanks: Dijkstra’s algorithm builds a _____ Tree.

A

Shortest Path

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

Dijkstra’s Algorithm follows which algorithm design paradigm?
A. Divide and Conquer
B. Greedy Method
C. Backtracking
D. Dynamic Programming

A

B. Greedy Method

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

What is the standard time complexity of Dijkstra’s algorithm using a Min-Heap (Priority Queue)?
A. O(V + E)
B. O(E log V)
C. O(V²)
D. O(log V)

A

B. O(E log V)

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

Fill in the Blanks: _____ is the step where d[v]is improved using d[u].

A

Relaxation

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

Fill in the Blanks: _____ is weight < 0 that causes standard Dijkstra to fail.

A

Negative Edge

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

Fill in the Blanks: _____ is the efficient greedy algorithm for non-negative weights Dijkstra’s Algorithm

A

Dijkstra’s Algorithm

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

Fill in the Blanks: _____ is the data structure optimizing the “extract-min” operation Priority Queue

A

Priority Queue

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

Fill in the Blanks: _____ is the algorithm that handles negative weights (but not negative cycles) Bellman-Ford Algorithm

A

Bellman-Ford Algorithm

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

True or False: Dijkstra’s algorithm can be used to find the shortest path from all sources to all destinations simultaneously.

A

TRUE

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

Fill in the Blanks: In Dijkstra’s algorithm, the operation of updating the distance of a neighbor is called _____.

A

Relaxation

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

What happens if we run Dijkstra’s algorithm on a graph with a negative cycle?
A. It will detect and remove the cycle
B. It automatically switches to Bellman-Ford
C. It will still produce correct shortest paths
D. It may enter an infinite loop or give incorrect results

A

D. It may enter an infinite loop or give incorrect results

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

Fill in the Blanks: The initial distance to the source vertex in Dijkstra’s algorithm is set to _____.

A

FALSE

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

If we use a simple array instead of a heap for Dijkstra’s, the time complexity becomes:
A. O(V²)
B. O(V log V)
C. O(E log V)
D. O(E + V)

A

A. O(V²)

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

Dijkstra’s algorithm fails if the graph contains:
A. Zero-weight edges
B. Positive cycles
C. Negative-weight edges
D. Disconnected components

A

C. Negative-weight edges

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

Fill in the Blanks: The process of picking the vertex with the smallest distance is an example of a _____ choice.

A

greedy

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

True or False: Dijkstra’s algorithm works on both directed and undirected graphs.

17
Q

Which data structure is most efficient for finding the vertex with the minimum tentative distance in Dijkstra’s?
A. Stack
B. Queue
C. Priority Queue (Min-Heap)
D. Linked List

A

C. Priority Queue (Min-Heap)

18
Q

True or False: Dijkstra’s algorithm can be used to find the shortest path from all sources to all destinations simultaneously.

19
Q

Fill in the Blanks: The initial distance to all other vertices (except source) is set to _____.

20
Q

If d[u] = 10, weight(u, v) = 5 and d[v] = 20, what will be the new value of d[v] after relaxation?
A. 25
B. 10
C. 5
D. 15