0
0
Data Structures Theoryknowledge~5 mins

Dijkstra's algorithm in Data Structures Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of Dijkstra's algorithm?
Dijkstra's algorithm finds the shortest path from a starting point to all other points in a graph with non-negative edge weights.
Click to reveal answer
beginner
What type of graphs can Dijkstra's algorithm be applied to?
It works on graphs with non-negative edge weights, whether directed or undirected.
Click to reveal answer
intermediate
How does Dijkstra's algorithm decide which node to visit next?
It always picks the unvisited node with the smallest known distance from the start.
Click to reveal answer
intermediate
What data structure is commonly used to efficiently select the next node in Dijkstra's algorithm?
A priority queue (or min-heap) is used to quickly find the node with the smallest distance.
Click to reveal answer
advanced
Why can't Dijkstra's algorithm handle graphs with negative edge weights?
Because it assumes once a node's shortest distance is found, it won't get shorter. Negative edges can break this assumption.
Click to reveal answer
What does Dijkstra's algorithm compute?
ADetect cycles in a graph
BMinimum spanning tree
CMaximum flow in a network
DShortest paths from one node to all others
Which data structure helps Dijkstra's algorithm pick the next node efficiently?
AStack
BQueue
CPriority queue
DLinked list
Dijkstra's algorithm cannot be used if the graph has:
ANegative edge weights
BMultiple nodes
CDirected edges
DLoops
What is the initial distance assigned to the starting node in Dijkstra's algorithm?
AInfinity
BZero
COne
DUndefined
When does Dijkstra's algorithm stop?
AWhen all nodes have been visited
BAfter visiting half the nodes
CWhen the shortest path to one node is found
DAfter a fixed number of steps
Explain how Dijkstra's algorithm finds the shortest path in a graph.
Think about how the algorithm updates distances and chooses nodes step by step.
You got /5 concepts.
    Describe why Dijkstra's algorithm does not work with negative edge weights.
    Consider what happens if a path gets shorter after a node is processed.
    You got /4 concepts.